시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB54272757.447%

문제

Martha takes a jar of quarters to the casino with the intention of becoming rich. She plays three machines in turn. Unknown to her, the machines are entirely predictable. Each play costs one quarter. The first machine pays $30$ quarters every $35^{th}$ time it is played; the second machine pays $60$ quarters every $100^{th}$ time it is played; the third pays $9$ quarters every $10^{th}$ time it is played.

입력

Your program should take as input the number of quarters in Martha's jar (there will be at least one and fewer than $1000$), and the number of times each machine has been played since it last paid.

출력

Your program should output the number of times Martha plays until she goes broke.

예제 입력 1

48
3
10
4

예제 출력 1

Martha plays 66 times before going broke.