Slot Machines | 프로그래밍의 벗 PivotOJ
PivotOJ

Slot Machines

시간 제한: 1000ms메모리 제한: 128MB출처: CCC 2000 SeniorBOJ 6943

문제

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 3030 quarters every 35th35^{th} time it is played; the second machine pays 6060 quarters every 100th100^{th} time it is played; the third pays 99 quarters every 10th10^{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 10001000), 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
출력
Martha plays 66 times before going broke.
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.