The Bus Card | 프로그래밍의 벗 PivotOJ
PivotOJ

The Bus Card

시간 제한: 1000ms메모리 제한: 1024MB출처: Programmeringsolympiaden 2010 — skolkvalBOJ 26934

문제

You are going to purchase a bus card. It's a refillable card that cash can be deposited into, and then used to ride the bus until you are out of money. You know that you're planning to travel for KK Swedish crowns (SEK). Charging the card takes some time since you can only charge it with 100100, 200200 or 500500 SEK at a time.

At the moment you are in a hurry, so you want to make as few transactions as possible, but never insert more money than necessary. If you are to travel for 800800 SEK, this means you should load it with 500500, then 200200, and then 100100 SEK. On the other hand, if you are traveling for 850850 SEK you should load it first with 500500, and then 200200 SEK twice. 5050 SEK will be wasted, but it's still the best alternative.

Compute the minimum number of transactions necessary.

입력

The input consists of the integer KK (1K100001 \le K \le 10\,000), the amount you will travel for.

출력

Output a single integer -- the number of transactions necessary.

예제

예제 1

입력
850
출력
3

예제 2

입력
1800
출력
5
코드를 제출하려면 로그인하세요.