Problems

# Cash machine

# Cash machine

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

#### Input

One number **n** (**1** ≤ **n** ≤ **1000000**).

#### Output

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

Input example #1

770

Output example #1

4