CSG-CPC
Online Judge

1020 : The Funny Number

         Time Limit: 1 Sec     Memory Limit: 128 Mb     Submitted: 1     Solved: 1    

Description

Add a specific digit p before and after a decimal positive integer k to get a new number. If the new number obtained is divisible by w, we call k a funny number.

Given p and w, could you get the smallest k?

For example: we set p=1 and w=9. The samllest k is 7, since add 1 before and after 7 we could get 171, which is divisible by 9. But numbers 1 ~ 6 (i.e. 111, 121, ... 161) could not.

Input

Each line contains two integer numbers p and w.

1 <= p <= 9 and 1 <= w <= 1000.

Output

For each case output oneline, The smallest funny number k in range [1, 10000].

If there’s no qualified k in range [1, 10000], output -1 instead.

Sample

1 9
8 10
5 819
7
-1
323

Hint

Author

CSGrandeur