Problem7258--ABC273 —— B - Broken Rounding

7258: ABC273 —— B - Broken Rounding

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

Given a non-negative integer $X$, perform the following operation for $i=1,2,…,K$ in this order and find the resulting $X$.
  • Round $X$ off to the nearest $10^i$.
    • Formally, replace $X$ with $Y$ that is "the largest multiple of $10^i$ that minimizes ∣Y−X∣."
    • Here are some examples:
      • Rounding 273 off to the nearest $10^2$ yields 300.
      • Rounding 999 off to the nearest $10^3$ yields 1000.
      • Rounding 100 off to the nearest $10^{10}$ yields 0.
      • Rounding 1015 off to the nearest $10^1$ yields 1020.

Input

The input is given from Standard Input in the following format:
X K

Output

Print the answer as an integer.

Constraints

X and K are integers.
$0≤X<10^{15}$
$1≤K≤15$

Sample 1 Input

2048 2

Sample 1 Output

2100
X changes as 2048→2050→2100 by the operations.

Sample 2 Input

1 15

Sample 2 Output

0

Sample 3 Input

999 3

Sample 3 Output

1000

314159265358979 12

314000000000000
X may not fit into a32-bit integer type.

Source/Category