HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Kovrov IT > problem:


2009.I. 50278 - ATM

Guest
• Discussion of problem (1)

Volume problems

• 2009.A. 50283 - Tetris 3D
• 2009.B. 50284 - Knights of the Rook
• 2009.C. 50285 - Meat store
• 2009.D. 50259 - Many-coloured roads
• 2009.E. 50266 - Kovrov
• 2009.F. 50267 - Interesting permutat...
• 2009.G. 50260 - What about judges?
• 2009.H. 50268 - Triangles
• 2009.I. 50278 - ATM
• 2010.A. 50287 - Providers
• 2010.B. 50281 - Primes
• 2010.C. 50255 - Bishops
• 2010.D. 50277 - Unusual Lottery
• 2010.E. 50664 - Polygons
• 2010.F. 50265 - Liars and Knights
• 2010.G. 50256 - Sequence
• 2010.H. 50282 - Coins

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Фёдор Меньшиков, ВГПУ.

ATM may contain notes of four kinds: 50, 100, 500 and 1000 rubles. Amount of notes of each kind at any moment is a non-negative integer number. 0 means that there are no notes of this kind. The lack of some notes may be filled with notes of smaller cost. E.g., if the client requested 500 rubles, but ATM has only four 100-ruble notes and two 50-ruble notes, the client will still get his cash.

Suppose that you requested a sum of cash, that is a positive integer number and divides by 50. ATM denied this request, since there is no way it could be done with notes available right now. Find the smallest sum greater than the requested one, such that ATM theoretically could give out.

Input
The first line of input contains a single positive number that divides by 50 and is less or equal to 3000. It's the sum that the ATM could not give out.
Output
Output the single number - the smallest sum greater than the requested one. If there is no such sum, output 0.

Input 1 Output 1
150
200

Для отправки решений необходимо выполнить вход.

www.contester.ru