#P423. 练72.4  口算练习题

练72.4  口算练习题

Description

Teacher Wang is teaching basic arithmetic operations. The careful teacher has collected ii mental arithmetic problems that students often get wrong and wants to organize them into a practice set. Arranging these problems is a tedious task, so he wants to use a computer program to improve efficiency. Teacher Wang hopes to minimize input work - for example, for the expression 5+85+8, he only needs to input 55 and 88. The output should be detailed enough to facilitate later typesetting, such as outputting 5+8=135+8=13 and the total length of the expression 66 for the above input. Teacher Wang has entrusted this honorable task to you, please help him implement this functionality.

Input Format

The first line contains an integer nn (1n501≤n≤50).
The next nn lines contain the expressions to be input, each line may have either three or two numbers.
If a line has three numbers, the first number indicates the operation type: aa for addition, bb for subtraction, cc for multiplication, followed by two numbers xx and yy representing the operands.
If a line has two numbers xx and yy, it means the operation type is the same as the previous problem, and these two numbers are the operands.
The data guarantees that the first expression has three numbers, and 0x,y<100000≤x,y<10000.

Output Format

Output 2n2n lines. For each input expression, the first line outputs the complete expression and result, and the second line outputs the total length of the expression.

Sample

4
a 64 46
275 125
c 11 99
b 46 64
64+46=110
9
275+125=400
11
11*99=1089
10
46-64=-18
9