Code
1#include <iostream>
2#include <cstdlib>
3#include <string>
4using namespace std;
5
6int tran[]={0,2,4,6,30,32,34,36,40,42,44,46,50,52,54,56,60,62,64,66};
7
8int main()
9{
10 int t,dig[15],pd,inp;
11 while(scanf("%d",&inp),inp!=0)
12 {
13 pd=0;
14 while(inp)
15 {
16 dig[pd++]=inp%20;
17 inp/=20;
18 }
19 bool flag=false;
20 if(pd>=8)
21 flag=true;
22 printf("%d",tran[dig[--pd]]);
23 for(t=pd-1;t>=0;t--)
24 {
25 if(t==6 && flag)
26 printf(",000,000");
27 printf(",%.3d",tran[dig[t]]);
28 }
29 printf("\n");
30 }
31
32 return 0;
33}
34