Yo`nalishlar
Hozirda online

Statistika

Masalalar soni: 909

Foydalanuvchilar soni: 8824

Jo'natishlar soni: 714622

Muhokama yozuvlari: 4541

Yangiliklar soni: 98

Yangiliklar izohlari: 1177


So'ngi izohlar

779. Cash machine
Vaqt limiti: 1 sekund
Xotira limiti: 64 MB

The cash machine contains the sufficient banknotes of denominations 10, 20, 50, 100, 200 and 500 hryvinias. Find the minimum number of bills that can be used to give an amount of n hryvnias or print -1 if its impossible.

Input

One integer number n (1  n  109).

Output

 Print the minimum number of banknotes to give n hryvnias or -1 if its impossible.

Input

Output

1

770

4

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com
Mening urinishlarim(0) Muhokama (1) Jo'natish Eng yaxshi yechimlar Barcha muvaffaqiyatli urinishlar(116) Barcha urinishlar(176)