B - Base K 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 200

問題文

整数 A,BK 進法表記で与えられます。
A \times B10 進法表記で出力してください。

注記

K 進法表記については、Wikipedia「位取り記数法」 を参照してください。

制約

  • 2 \leq K \leq 10
  • 1 \leq A,B \leq 10^5
  • A,BK 進法表記で与えられる

入力

入力は以下の形式で標準入力から与えられる。

K
A B

出力

答えを出力せよ。


入力例 1

2
1011 10100

出力例 1

220

2 進法表記の 1011 を 、10 進法表記すると 11 です。
2 進法表記の 10100 を、 10 進法表記すると 20 です。
11 \times 20 = 220 なので 220 を出力します。


入力例 2

7
123 456

出力例 2

15642

7 進法表記の 123 を 、10 進法表記すると 66 です。
7 進法表記の 456 を、 10 進法表記すると 237 です。
66 \times 237 = 15642 なので 15642 を出力します。

Score : 200 points

Problem Statement

You are given integers A and B, in base K.
Print A \times B in decimal.

Notes

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

Constraints

  • 2 \leq K \leq 10
  • 1 \leq A,B \leq 10^5
  • A and B are in base-K representation.

Input

Input is given from Standard Input in the following format:

K
A B

Output

Print the answer.


Sample Input 1

2
1011 10100

Sample Output 1

220

1011 in base 2 corresponds to 11 in base 10.
10100 in base 2 corresponds to 20 in base 10.
We have 11 \times 20 = 220, so print 220.


Sample Input 2

7
123 456

Sample Output 2

15642

123 in base 7 corresponds to 66 in base 10.
456 in base 7 corresponds to 237 in base 10.
We have 66 \times 237 = 15642, so print 15642.