You are given three integers n, a, and b. Find the smallest integer m greater than n whose digit sum in base a equals its digit sum in base b.
Input
The input is a single test case. The first line holds three integers n, a, and b, separated by spaces, with 0≤n≤1016 and 2≤a<b≤36. All three are given in base 10.
Output
Print in base 10, on one line, the smallest integer m greater than n whose digit sum in base a equals its digit sum in base b. The value of m can be larger than 1016.