Fun with Numbers

0

0 votes
Easy
Problem

You are given 2 numbers n1 and n2. You are supposed to add them and print the result.
Easy!?
Well, the given numbers are in base b. So you have to add them and print the result in base b. (Refer to examples for more clarification.)

Input:

First line contains an integer t - the no of test cases.
Next t lines contain 3 integers b, n1 and n2 each.

Output:

Print a single integer in every line which is the sum of n1 and n2.

Constraints:

1 ≤ t ≤ 10000

1 < b < 10

1 ≤ n1, n2 (in their decimal form) ≤ 10123

Problem Setter: HARSH GANDA

Sample Input
3
2 1010 1111
3 12 210
8 1 7
Sample Output
11001
222
10
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

(1010)2 + (1111)2 = (11001)2

(12)3 + (210)3 = (222)3

(1)8 + (7)8 = (10)8

Contributers:
Editor Image

?