B - 200th ABC-200 Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

整数 N が与えられます。
以下の操作を K 回行った後の整数 N を出力してください。

  • 整数 N200 の倍数であれば、N200 で割る。
  • そうでなければ、整数 N を、N の後ろに文字列として 200 を付け加えた整数に置き換える。
    • 例えば、7 を置き換えると 7200 に、1234 を置き換えると 1234200 になります。

制約

  • 入力は全て整数
  • 1 \le N \le 10^5
  • 1 \le K \le 20

入力

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

N K

出力

答えを整数として出力せよ。


入力例 1

2021 4

出力例 1

50531

N=20214 回操作を行うと、N の値は操作を行うごとに 2021 \rightarrow 2021200 \rightarrow 10106 \rightarrow 10106200 \rightarrow 50531 となります。


入力例 2

40000 2

出力例 2

1

入力例 3

8691 20

出力例 3

84875488281

答えは 32 bit 符号付き整数型に収まらない可能性があります。

Score : 200 points

Problem Statement

You are given an integer N.
Do the following operation K times on it and print the resulting integer.

  • If N is a multiple of 200, divide it by 200.
  • Otherwise, see N as a string and append 200 to the end of it.
    • For example, 7 would become 7200 and 1234 would become 1234200.

Constraints

  • All values in input are integers.
  • 1 \le N \le 10^5
  • 1 \le K \le 20

Input

Input is given from Standard Input in the following format:

N K

Output

Print the answer as an integer.


Sample Input 1

2021 4

Sample Output 1

50531

Applying the operation on N=2021 results in N becoming 2021 \rightarrow 2021200 \rightarrow 10106 \rightarrow 10106200 \rightarrow 50531.


Sample Input 2

40000 2

Sample Output 2

1

Sample Input 3

8691 20

Sample Output 3

84875488281

The answer may not fit into the signed 32-bit integer type.