1 #include <iostream>
2 #include <cstdio>
3 #include <cstdlib>
4 #include <cstring>
5 #define UNIT 10
6
7 using namespace std;
8
9 struct Bignum
10 {
11 int val[105];
12 int len;
13
14 Bignum ()
15 {
16 memset (val, 0, sizeof(val));
17 len = 1;
18 }
19
20 Bignum operator + (const Bignum &a) const//大数加大数
21 {
22 Bignum x = a;
23 int L;
24 L = a.len > len ? a.len : len;
25 for (int i = 0; i < L; ++i)
26 {
27 x.val[i] += val[i];
28 if (x.val[i] >= UNIT)
29 {
30 x.val[i+1]++;
31 x.val[i] -= UNIT;
32 }
33 }
34 if (x.val[L] != 0)
35 x.len = L+1;
36 else
37 x.len = L;
38 return x;
39 }
40
41 };
42 int main()
43 {
44 // freopen("ACM.txt","r",stdin);
45 char a[105];
46 Bignum x,ans;
47 for(;;)
48 {
49 Bignum(x);
50 scanf("%s",a);
51 int L=strlen(a);
52 x.len=0;
53 for(int i=L-1;i>=0;i--)
54 {
55 x.val[x.len++]=a[i]-‘0‘;
56 }
57 if(x.len==1&&x.val[0]==0) break;
58 ans=ans+x;
59
60 }
61 for(int i=ans.len-1;i>=0;i--)
62 cout<<ans.val[i];
63 cout<<endl;
64 return 0;
65 }