Frankfurt UAS, KMITL, VGU & SPbGUT - Combinatorics & Number Theory

Start

2017-03-26 21:00 AKDT

Frankfurt UAS, KMITL, VGU & SPbGUT - Combinatorics & Number Theory

End

2017-03-30 10:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -1667 days 3:29:15

85:00:00

0:00:00

Problem GRational Arithmetic

Input

The first line of input contains one integer, giving the number of operations to perform.

Then follow the operations, one per line, each of the form $x_1\ y_1\ \mbox{op}\ x_2\ y_2$. Here, $-10^9 \leq x_1, y_1, x_2, y_2 < 10^9$ are integers, indicating that the operands are $x_1/y_1$ and $x_2/y_2$. The operator op is one of ’$+$’, ’$-$’, ’$*$’, ’$/$’, indicating which operation to perform.

You may assume that $y_1 \ne 0$, $y_2 \ne 0$, and that $x_2 \ne 0$ for division operations.

Output

For each operation in each test case, output the result of performing the indicated operation, in shortest terms, in the form indicated.

Sample Input 1 Sample Output 1
4
1 3 + 1 2
1 3 - 1 2
123 287 / 81 -82
12 -3 * -1 -1

5 / 6
-1 / 6
-82 / 189
-4 / 1