J. MUV LUV EXTRA
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

One day, Kagami Sumika is stuck in a math problem aiming at calculating the length of a line segment with given statements and constraints. Since Sumika has no idea about it, she takes out a ruler and starts to measure the length. Unfortunately, the answer is an infinite decimal and she only got the first some digits of the answer from the ruler.

Sumika guesses that the answer is a rational number, which means that there exists two integers $$$p,q$$$ that the answer equals $$$\frac{q}{p}$$$. In this situation, the answer can be expressed as an infinite repeated decimal. For example, $$$\frac{1}{2} = 0.500\cdots, \frac{1}{3} = 0.333\cdots, \frac{9}{10}=0.8999\cdots,\frac{36}{35}=1.0285714285714\cdots$$$. Sumika wants to guess the original number from the digits she got. Note that a number may has more than one way to be expressed such as $$$1.000\cdots=0.999\cdots$$$. Sumika won't transform the digits she got to another form when guessing the original number.

Furthermore, Sumika relizes that for a repeating part, either too long or the appeared length too short will make the result unreliable. For example, if the decimal she measured is 1.0285714285714, it is obviously unreliable that the repeating part is "0285714285714", since it is too long, or "428571", since the appeared length is too short, which equals 7, the length of "4285714". In this case, the best guess is "285714", whose length is 6 and the appeared length is 12. So formally, she defines the reliability value of a repeating part, whose length is $$$l$$$ and the appeared length is $$$p$$$, as the following formula: $$$$$$a\times p - b\times l$$$$$$

Where $$$a$$$ and $$$b$$$ are given parameters.

Last but not least, you can ignore the integer parts of the decimal. It is just for restoring the scene. And the repeating part you guess should be completely repeated at least once and is still repeating at the end currently.

Please help Sumika determine the maximum reliability value among all repeating parts.

Input

The first line contains two positive integers $$$a,b~(1\le a,b \le 10^9)$$$, denoting the parameters.

The next line contains a string $$$s~(1\le |s| \le 10^7)$$$ in decimal form, denoting the first some digits of the accurate result.

It is guaranteed that there is exactly one decimal point in $$$s$$$ and $$$s$$$ is a legal non-negative decimal without leading "-"(the minus sign).

Output

Output a single line containing an integer, denoting the maximum reliability value.

Examples
Input
5 3
1.1020
Output
9
Input
2 1
12.1212
Output
6
Note

For the first case, all possible repeating parts are as follows:

repeating partlengthappeared lengthreliability value
011$$$5 \times 1 - 3 \times 1=2$$$
2022$$$5\times 2 - 3 \times 2 = 4$$$
0223$$$5\times 3 - 3\times 2 = 9$$$
02033$$$5\times 3 - 3\times 3 = 6$$$
102044$$$5\times 4 - 3\times 4 = 8$$$

For the second case, all possible repeating parts are as follows:

repeating partlengthappeared lengthreliability value
211$$$2 \times 1 - 1 \times 1=1$$$
1224$$$2\times 4 - 1 \times 2 = 6$$$
2123$$$2\times 3 - 1\times 2 = 4$$$
21233$$$2\times 3 - 1\times 3 = 3$$$
121244$$$2\times 4 - 1\times 4 = 4$$$