#include <bits/stdc++.h>
using namespace std;
int n;
string str;
char k;
int x, y;
int main()
{
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> str;
if (str[0] == 'a' || str[0] == 'b' || str[0] == 'c')
{
k = str[0];
cin >> x >> y;
}
else
{
x = 0;
for (int i = 0; str[i] != '\0'; i++)
{
x += i * 10 + str[i];
}
cin >> y;
}
int ans;
if (k == 'a')
{
ans = x + y;
cout << x << "+" << y << "=" << x + y << endl;
}
else if (k == 'b')
{
ans = x - y;
cout << x << "-" << y << "=" << x - y << endl;
}
else if (k == 'c')
{
ans = x * y;
cout << x << "*" << y << "=" << x * y << endl;
}
int cnt = 0;
if (ans < 0) cnt++;
while(x != 0)
{
x = x / 10;
++cnt;
}
while(y != 0)
{
y = y / 10;
++cnt;
}
while(ans != 0)
{
ans = ans / 10;
++cnt;
}
cout << 2 + cnt << endl;
}
return 0;
}