900B.md (1226B)
1 Source: https://codeforces.com/problemset/problem/900/B 2 3 B. Position in Fraction 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You have a fraction . You need to find the first occurrence of digit *c* into decimal notation of the fraction after decimal point. 22 23 Input 24 25 The first contains three single positive integers *a*, *b*, *c* (1 ≤ *a* < *b* ≤ 105, 0 ≤ *c* ≤ 9). 26 27 Output 28 29 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. 30 31 Examples 32 33 Input 34 35 ``` 36 1 2 0 37 ``` 38 39 Output 40 41 ``` 42 2 43 ``` 44 45 Input 46 47 ``` 48 2 3 7 49 ``` 50 51 Output 52 53 ``` 54 -1 55 ``` 56 57 Note 58 59 The fraction in the first example has the following decimal notation: . The first zero stands on second position. 60 61 The fraction in the second example has the following decimal notation: . There is no digit 7 in decimal notation of the fraction.