ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT 2009 > задача:


Задачи сборника

• A. Tetris 3D
• B. Knights of the Rook
• C. Meat store
• D. Many-coloured roads
• E. Kovrov
• F. Interesting permutations
• G. What about judges?
• H. Triangles
• I. ATM

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Фёдор Меньшиков, ВГПУ.

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.

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 the single number - the smallest sum greater than the requested one. If there is no such sum, output 0.

Input 1 Output 1

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