P1604 Base-B Planet

Background

A number base problem, and it's also a calculator.

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\ (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 $B$ addition. Now Xiao Z hopes you can help him by writing a program that performs base $B$ addition.

Input Format

The testdata consists of three lines. The first line contains a decimal integer representing the base $B$. The second and third lines each contain a positive integer in base $B$. Each digit belongs to $\{\tt 0,1,2,3,4,5,6,7,8,9,A,B\cdots\}$.

Output Format

A base $B$ number representing the sum of the two input numbers.

Explanation/Hint

Constraints Let $n, m$ denote the lengths of the two base $B$ numbers. For all testdata, $1 \le n, m \le 2000$. Translated by ChatGPT 5