100 atcoder#ABC220B. [ABC220B] Base K

[ABC220B] Base K

Score : 200200 points

Problem Statement

You are given integers AA and BB, in base KK. Print A×BA \times B in decimal.

Notes

For base-KK representation, see Wikipedia's article on Positional notation

.

Constraints

  • 2K102 \leq K \leq 10
  • 1A,B1051 \leq A,B \leq 10^5
  • AA and BB are in base-KK representation.

Input

Input is given from Standard Input in the following format:

KK

AA BB

Output

Print the answer.

2
1011 10100
220

1011 in base 22 corresponds to 1111 in base 1010. 10100 in base 22 corresponds to 2020 in base 1010. We have 11×20=22011 \times 20 = 220, so print 220220.

7
123 456
15642

123 in base 77 corresponds to 6666 in base 1010. 456 in base 77 corresponds to 237237 in base 1010. We have 66×237=1564266 \times 237 = 15642, so print 1564215642.