code:
#include<cctype>
#include<cstdio>
using namespace std;
char s;
inline long long read()
{
long long a=0,b=1;
char c=getchar();
if(c=='a'||c=='b'||c=='c')s=c,c=getchar();
while(!isdigit(c)){if(c=='-')b=-1;c=getchar();}
while(isdigit(c))
{
a=(a<<3)+(a<<1)+(c^48);
c=getchar();
}
return a*b;
}
inline void write(long long a)
{
if(a<0)putchar('-'),a=-a;
if(a>=10)write(a/10);
putchar(a%10+48);
return;
}
int main()
{
int n=read();
for(int i=1;i<=n;i++)
{
int a=read(),b=read();
if(s=='a')
{
write(a);
putchar('+');
write(b);
putchar('=');
write(a+b);
puts("");
int ans=0,num=a+b;
while(a)a/=10,ans++;
while(b)b/=10,ans++;
while(num)num/=10,ans++;
write(ans+2);
puts("");
}
if(s=='b')
{
write(a);
putchar('-');
write(b);
putchar('=');
write(a-b);
puts("");
int ans=0,num=a-b;
if(num<=0)ans++,num=-num;
while(a)a/=10,ans++;
while(b)b/=10,ans++;
while(num)num/=10,ans++;
write(ans+2);
puts("");
}
if(s=='c')
{
write(a);
putchar('*');
write(b);
putchar('=');
write(a*b);
puts("");
int ans=0,num=a*b;
while(a)a/=10,ans++;
while(b)b/=10,ans++;
while(num)num/=10,ans++;
write(ans+2);
puts("");
}
}
return 0;
}