#P1604. B进制星球

B进制星球

Description

One day, Xiao Z traveled by spaceship to a beautiful planet. For historical reasons, technology on this beautiful planet is not very advanced, and people commonly use base B (2B36)B\ (2 \le B \le 36) for counting. The locals treated Xiao Z with delicious food; as a return, Xiao Z wants to give them a calculator that can perform base BB addition. Now Xiao Z hopes you can help him by writing a program that performs base BB addition.

Input Format

The testdata consists of three lines.

The first line contains a decimal integer representing the base BB.

The second and third lines each contain a positive integer in base BB. Each digit belongs to {0,1,2,3,4,5,6,7,8,9,A,B}\{\tt 0,1,2,3,4,5,6,7,8,9,A,B\cdots\}.

Output Format

A base BB number representing the sum of the two input numbers.

4
123
321

1110

Hint

Constraints

Let n,mn, m denote the lengths of the two base BB numbers.

For all testdata, 1n,m20001 \le n, m \le 2000.

Translated by ChatGPT 5