A simple 8-digit electronic calculator contains the following buttons: “1234567890+-*/=” (no quotes). It can be divided into the following categories:

Digit: “1234567890”

You can input any number with digital buttons (ignore leading zero). Notice, the LED of calculator can only display 8 digits. So when the number of digits large than eight, only the first eight digits will be retained. And when the number of one result’s digits large than eight, error occurs.

Operator: “+-*/”

For simplicity, all operations are integer operations. Some continuous operators, the last one is valid. When an operator button is pressed, the calculation before that will be completed.

Equal-sign: “=”

If the second operand is missing, you can think it equal the first operand. More than one continuous equal-sign means repeat the operation. You can observe the following examples.

The first line is number of test cases. After that, each case consists of one line, containing a string means pressed button. The length of string is less than 100. There is no additional space.

提交代码