#include <iostream>
#include <string>
#include<cstdio>
#include<vector>
#include <sstream>
using namespace std;
class A
{
private:
string s,a,b,t;
int n;
vector<string> m;
vector<string>::iterator p;
public:
A()
{
cin>>n;
getchar();
while(n--)
{
getline(cin,s);
m.push_back(s);
}
}
int str_num(string s)
{
int n;
stringstream ss;
ss<<s;
ss>>n;
return n;
}
string num_str(int n)
{
string temp;
stringstream ss;
ss<<n;
ss>>temp;
return temp;
}
void handle()
{
char first=' ';
int pos;
p=m.begin();
while(p!=m.end())
{
s=(*p);
pos=0;
if(!isdigit(s[0]))
{
pos = s.find(' ',pos+2);
a = s.substr(2,pos-2);
b = s.substr(pos+1);
first = s[0];
}
else
{
pos = s.find(' ',pos);
a = s.substr(0,pos);
b = s.substr(pos+1);
}
if(first == 'a')
{
t = a + "+" + b + "=" + num_str(str_num(a) + str_num(b));
cout<<t<<endl;
cout<<t.size()<<endl;
}
else if(first == 'b')
{
t= a + "-" + b + "=" + num_str(str_num(a) - str_num(b));
cout<<t<<endl;
cout<<t.size()<<endl;
}
else if(first == 'c')
{
t= a + "*" + b + "=" + num_str(str_num(a) * str_num(b));
cout<<t<<endl;
cout<<t.size()<<endl;
}
p++;
}
}
};
int main()
{
A t;
t.handle();
return 0;
}