#include<iostream> //#include<fstream> #include<string> using namespace std; int max(int a,int b) { if(a>b) return a; else return b; } int main() { // ifstream in("in.dat",ios::in); int a[1005],n,i,b[1005],flag,j,w,mlen,la,lb; string stra,strb; cin>>n; for(i=0;i<n;i++) { cin>>stra>>strb; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); cout<<"Case "<<i+1<<":"<<endl; la=stra.length(); lb=strb.length(); mlen=max(la,lb)+1; w=0; for(j=la-1;j>=0;j--) a[w++]=stra[j]-'0'; w=0; for(j=lb-1;j>=0;j--) b[w++]=strb[j]-'0'; for(j=0;j<=mlen;j++) { a[j]+=b[j]; if(a[j]>=10) { a[j]-=10; a[j+1]++; } } flag=0; cout<<stra<<" + "<<strb<<" = "; for(j=mlen;j>=0;j--) if(flag) cout<<a[j]; else if(a[j]) { cout<<a[j]; flag=1; } if(la==1&&lb==1&&stra[0]=='0'&&strb[0]=='0') cout<<'0'; cout<<endl; if(i!=n-1) cout<<endl; } return 0; }