Codeforces Round 450 (Div. 2)
B
Position in Fraction
Codeforces
1300
原题
← AC →
翻译中…

You have a fraction image. You need to find the first occurrence of digit $*c*$ into decimal notation of the fraction after decimal point.

翻译中…

Input

翻译中…

The first contains three single positive integers $*a*$, $*b*$, $*c*$ ($1 ≤ *a* < *b* ≤ 10^{5}$, $0 ≤ *c* ≤ 9$).

翻译中…

Output

翻译中…

Print position of the first occurrence of digit $*c*$ into the fraction. Positions are numbered from $1$ after decimal point. It there is no such position, print -1.

翻译中…

Note

翻译中…

The fraction in the first example has the following decimal notation: image. The first zero stands on second position.

翻译中…

The fraction in the second example has the following decimal notation: image. There is no digit $7$ in decimal notation of the fraction.

翻译中…

样例

Input #1
1 2 0
Output #1
2
InputCopy OutputCopy
Input #2
2 3 7
Output #2
-1
InputCopy OutputCopy
题目信息
题号
900B
时间限制
1 s
内存限制
256 MB
标签
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。