#include<cstdio>
#include<iomanip>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include <string>
#include<cmath>
#include<map>
using namespace std;
int a,c,d,pduan,e;
string b2;
int length(int n)
{
int changdu=0;
if(n==0||n<0)
{
changdu++;
}
while(n)
{
changdu++;
n=n/10;
}
return changdu;
}
int main()
{
cin>>a;
for(int i=0; i<=a; i++)
{
cin>>b2;
if(b2=="a")
{
pduan=1;
cin>>c>>d;
cout<<c<<'+'<<d<<'='<<c+d<<endl<<length(c)+length(d)+length(c+d)+2;
if(i!=a-1)cout<<endl;
}
if(b2=="b")
{
pduan=2;
cin>>c>>d;
cout<<c<<'-'<<d<<'='<<c-d<<endl<<length(c)+length(d)+length(c-d)+2;
if(i!=a-1)cout<<endl;
}
if(b2=="c")
{
pduan=3;
cin>>c>>d;
cout<<c<<'*'<<d<<'='<<c*d<<endl<<length(c)+length(d)+length(c*d)+2;
if(i!=a-1)cout<<endl;
}
else if(b2<"a"||b2>"c")
{
if(pduan==1)
{
e=atoi(b2.c_str());
cin>>d;
cout<<e<<'+'<<d<<'='<<e+d<<endl<<length(e)+length(d)+length(e+d)+2;
if(i!=a-1)cout<<endl;
}
if(pduan==2)
{
e=atoi(b2.c_str());
cin>>d;
cout<<e<<'-'<<d<<'='<<e-d<<endl<<length(e)+length(d)+length(e-d)+2;
if(i!=a-1)cout<<endl;
}
if(pduan==3)
{
e=atoi(b2.c_str());
cin>>d;
cout<<e<<'*'<<d<<'='<<e*d<<endl<<length(e)+length(d)+length(e*d)+2;
if(i!=a-1)cout<<endl;
}
}
}
}