Problem H
Rational 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
You may assume that
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 |