Candy Purchase

Interview

Time limit1sMemory limit128 MB

Summary
Given a price and a bill denomination that is a power of ten, round the price to the nearest multiple of that denomination, rounding up on ties.
Level

Easy3 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

It is White Day, and Sanggeun wants to buy candy for his girlfriend. He only carries bills of one denomination, has infinitely many of them, and does not receive change.

After Sanggeun tells the shop owner the denomination of his bills, the owner changes the candy price to the nearest amount that Sanggeun can pay. If the price is exactly halfway between two payable amounts, it is rounded up.

The bill denomination is always one of 1, 10, 100, 1000, ..., 1,000,000,000.

Given the candy price and the number of zeros in Sanggeun's bill denomination, determine the price the owner will set.

Input

The first line contains the candy price C and the number K of zeros in the bill denomination 10^K. (0 <= C <= 1,000,000,000, 0 <= K <= 9)

Output

Print the price Sanggeun must pay.

Examples3

  1. Example 1

    Input
    184 1
    
    Expected output
    180
    
  2. Example 2

    Input
    123450995 1
    
    Expected output
    123451000
    
  3. Example 3

    Input
    182 2
    
    Expected output
    200