시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 2741 1773 1586 65.348%

문제

타로는 자주 JOI잡화점에서 물건을 산다. JOI잡화점에는 잔돈으로 500엔, 100엔, 50엔, 10엔, 5엔, 1엔이 충분히 있고, 언제나 거스름돈 갯수가 가장 적게 잔돈을 준다. 타로가 JOI잡화점에서 물건을 사고 카운터에서 1000엔 지폐를 한장 냈을 때, 받을 잔돈에 포함된 잔돈의 갯수를 구하는 프로그램을 작성하시오.

예를 들어 입력된 예1의 경우에는 아래 그림에서 처럼 4개를 출력해야 한다.

입력

입력은 한줄로 이루어져있고, 타로가 지불할 돈(1 이상 1000미만의 정수) 1개가 쓰여져있다.

출력

제출할 출력 파일은 1행으로만 되어 있다. 잔돈에 포함된 매수를 출력하시오.

예제 입력 1

380

예제 출력 1

4

힌트

W3sicHJvYmxlbV9pZCI6IjU1ODUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjNzBcdWMyYTRcdWI5ODRcdWIzYzgiLCJkZXNjcmlwdGlvbiI6IjxwPlx1ZDBjMFx1Yjg1Y1x1YjI5NCBcdWM3OTBcdWM4ZmMgSk9JXHVjN2ExXHVkNjU0XHVjODEwXHVjNWQwXHVjMTFjIFx1YmIzY1x1YWM3NFx1Yzc0NCBcdWMwYjBcdWIyZTQuIEpPSVx1YzdhMVx1ZDY1NFx1YzgxMFx1YzVkMFx1YjI5NCBcdWM3OTRcdWIzYzhcdWM3M2NcdWI4NWMgNTAwXHVjNWQ0LCAxMDBcdWM1ZDQsIDUwXHVjNWQ0LCAxMFx1YzVkNCwgNVx1YzVkNCwgMVx1YzVkNFx1Yzc3NCBcdWNkYTlcdWJkODRcdWQ3ODggXHVjNzg4XHVhY2UwLCBcdWM1YjhcdWM4MWNcdWIwOTggXHVhYzcwXHVjMmE0XHViOTg0XHViM2M4IFx1YWMyZlx1YzIxOFx1YWMwMCBcdWFjMDBcdWM3YTUgXHVjODAxXHVhYzhjIFx1Yzc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