BlueBook
Given two integers
and
(
- base 10), in bases
and
, output the result of either + - * /
in the
integral base
. The resulting answer will be less than
in base 10, and will always be positive.
Perform integer division
on the operands. Substitute the
operand into (
<operand here>
) - so you should perform
,
, etc.
Input Specification
Line
: One integer
denoting the number of test cases.
test cases follow, and each test case consists of 6 lines, with test
cases separated by newlines.
Each test case has the following format:
Line 1: 
Line 2: 
Line 3: 
Line 4: 
Line 5: The operand (Either +
, -
, *
, or /
)
Line 6: 
Sample Input
Copy
2
10
123
10
456
+
10
8
777
5
333
-
2
Sample Output
Copy
579
110100010
Comments