A Base Problem

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

You are given \(2\) integers \(x\) and \(y\), which are in base \(b\). Please print out the sum, and product of \(x\) and \(y\) in base \(b\).

Input Specification

The first line will contain the integer \(b\ (2 \le b \le 10)\).

The second line will contain the integer \(x\).

The third line will contain the integer \(y\).

\(x\) and \(y\) will each contain at most \(5\) digits, and each digit will be in the range \([0, b)\). \(x\) and \(y\) will not contain leading zeros.

Output Specification

On the first line, output the sum of \(x\) and \(y\).

On the second line, output the product of \(x\) and \(y\).

Subtasks

Subtask 1 [20%]

\(b = 10\)

Subtask 2 [80%]

No further constraints.

Sample Input

10
3
5

Sample Output

8
15

Comments

There are no comments at the moment.