9152: Multiplication

内存限制:128 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:0 通过:0

题目描述


Xiao fan is a third grader in Springfield Flower Kindergarten, and he learned multiplication of multi-digit numbers by one-digit numbers last week. Clever as he was, he soon found some unusual numbers -- multiplying these numbers by a specific one-digit integer kkk (2≤k≤92\le k\le 92k9) results in movement of some trailing digits to the front. For example, the following picture shows that 142857142857142857 is a 333-shifting number.

Xiao fan wants to find the largest kkk-shifting number less than or equal to nnn. However, this task is too difficult for him, so he turns to you for help!

输入格式


The first and second line contains two integers nnn and kkk (0≤n<10100, 2≤k≤90\le n<10^{100},~ 2\le k\le 90n<10100, 2k9) respectively.

输出格式


Print a single integer -- the largest kkk-shifting number less than or equal to nnn. The answer always exists since 000 is always an kkk-shifting number for any kkk.

输入样例 复制

142857
3

输出样例 复制

142857