Numbers

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

      Consider numbers from 1 to n.
      You have to find the smallest lexicographically number among them which is divisible by k.

Input

      Input file contains several test cases. Each test case consists of two integer numbers n and k on a line(1 ≤ n ≤ 1018, 1 ≤ k ≤ n).

      The last test case is followed by a line that contains two zeroes. This line must not be processed.

Output

      For each test case output one integer number — the smallest lexicographically number not exceeding n which is divisible by k.

Sample Input

2000 17
2000 20
2000 22
0 0

Sample Output

1003
100
1012

Hint

多组数据

Source

Andrew Stankevich Contest 22

Manager

Information
Solved Number285
Submit Number1209
Problem Tags
greedy
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel