## p309ex13: Calculator

Given two integers A and B (0 ≤ A, B < 2^32 - base 10), in bases B1 and B2 (2 ≤ B1, B2 ≤ 10), output the result of either `+ - * /` in the integral base BF (2 ≤ BF ≤ 10). The resulting answer will be less than 2^32 in base 10, and will always be positive.

Perform integer division (5 / 2 = 2) on the operands. Substitute the operand into (A <operand here> B) - so you should perform (A - B), (A / B), etc.

### Input

Line 1: One integer T (1 ≤ T ≤ 100) denoting the number of test cases.
T 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: B1
Line 2: N1
Line 3: B2
Line 4: N2
Line 5: The operand (Either '+', '-', '*', or '/')
Line 6: BF

```2
10
123
10
456
+
10

8
777
5
333
-
2

```

### Sample Output

```579
110100010```

Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

• (0/0)
why do i get re and mismatch, code works well on my complier, can someone help me?, so what is the problem exactly? im using long and chars in the correct places

• (0/0)

• (0/0)
this is hard, just to clarify, is Integer.toString disqualified?

• (2/2)
What does the program mean?
are you doing 2+123+10+456+10 in test case one. What does the program do? thank you

• (0/0)
 Given two integers A and B (0 ≤ A, B < 2^32 - base 10), in bases B1 and B2 (2 ≤ B1, B2 ≤ 10), output the result of either + - * / in the integral base BF (2 ≤ BF ≤ 10).