#include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> #include<math.h> #define N 1010 char s1[N], s2[N]; int a[N], b[N], c[N]; int main() { int T, len1, len2, i, k, cnt=1; scanf("%d", &T); getchar(); while(T--) { scanf("%s %s", s1, s2); getchar(); len1=strlen(s1); len2=strlen(s2); memset(a, 0, sizeof(a)); memset(b, 0, sizeof(b)); memset(c, 0, sizeof(c)); k=0; for(i=len1-1; i>=0; i--) a[k++]=s1[i]-'0'; k=0; for(i=len2-1; i>=0; i--) b[k++]=s2[i]-'0'; for(i=0; i<len1 && i<len2; i++) { if(a[i]+b[i]+c[i]>9) { c[i]=(a[i]+b[i]+c[i])%10; c[i+1]=1; } else { c[i]=a[i]+b[i]+c[i]; } } while(i<len1) { if(c[i]+a[i]>9) { c[i]=(c[i]+a[i])%10; c[i+1]=1; } else { c[i]=c[i]+a[i]; } i++; } while(i<len2) { if(c[i]+b[i]>9) { c[i]=(c[i]+b[i])%10; c[i+1]=1; } else { c[i]=c[i]+b[i]; } i++; } i=N-1; while(!c[i]) i--; if(cnt>1) printf(" "); printf("Case %d: ", cnt++); printf("%s + %s = ", s1, s2); for(; i>=0; i--) printf("%d", c[i]); printf(" "); } return 0; }