1 #include <cmath>
2 #include <cstdio>
3 #include <cstring>
4 #include <algorithm>
5 using namespace std;
6 int main() {
7 char s1[1000],s2[1000],s3[1001];
8 int num1[1000],num2[1000],num3[1001],t,T;
9 for(scanf("%d",&T),t=1; t<=T; t++) {
10 scanf("%s%s",s1,s2);
11 memset(num1,0,sizeof(num1));
12 memset(num2,0,sizeof(num2));
13 memset(num3,0,sizeof(num3));
14 memset(s3,0,sizeof(s3));
15 int len1=strlen(s1),len2=strlen(s2),len3=max(len1,len2);
16 for(int i=len1-1,cnt=0;i>=0;num1[cnt++]=s1[i]-'0',i--);
17 for(int i=len2-1,cnt=0;i>=0;num2[cnt++]=s2[i]-'0',i--);
18 for(int i=0;i<len3;i++)num3[i]=num1[i]+num2[i];
19 for(int i=0;i<len3;i++)if(num3[i]>9)num3[i+1]++,num3[i]%=10;
20 if(num3[len3])len3++;
21 for(int i=len3-1,cnt=0; i>=0; i--) s3[cnt++]=num3[i]+'0';
22 printf("Case %d:
%s + %s = %s
",t,s1,s2,s3);
23 if(t!=T)printf("
");
24 }
25 return 0;
26 }