#abc220b. B - Base K

B - Base K

Score : 200200 points

问题描述

你已知两个整数 AABB,它们以 KK 进制表示。
请输出 A×BA \times B 转换为十进制后的结果。

以上为通义千问 qwen-max 翻译,仅供参考。

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.

Sample Input 1

2
1011 10100

Sample Output 1

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.

Sample Input 2

7
123 456

Sample Output 2

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.

update @ 2024/3/10 09:43:03