시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 545 111 76 24.051%

문제

찰리는 돈을 좀 가지고 있다. 그는 특히 동전에 관심이 좀 있어서 동전을 여러 개 가지고 있다. 그런데 동전이 자꾸 쌓여가자, 그는 처리에 곤란을 느끼고 이 동전들을 처분하기로 마음먹었다.

찰리는 1센트짜리 동전을 A개, 5센트(nickel)짜리 동전을 B개, 10센트(dime)짜리 동전을 C개, 25센트(quarter)짜리 동전을 D개 가지고 있다. 찰리는 이를 이용하여 X원짜리 커피를 사려 하는데, 이때 사용하는 동전의 개수를 최대로 하려 한다.

이러한 정보가 주어질 때, 사용하는 동전의 개수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 다섯 정수 X(1≤X≤10,000), A, B, C, D(0≤A, B, C, D≤10,000)가 주어진다.

출력

첫째 줄에 답을 출력한다. Cent의 수, nickel의 수, dime의 수, quarter의 수를 출력한다. 불가능한 경우에는 0을 네 개 출력한다.

예제 입력 1

12 5 3 1 2

예제 출력 1

2 2 0 0
W3sicHJvYmxlbV9pZCI6IjIwOTEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIzZDlcdWM4MDQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1Y2MzMFx1YjlhY1x1YjI5NCBcdWIzYzhcdWM3NDQgXHVjODgwIFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWIyZTQuIFx1YWRmOFx1YjI5NCBcdWQyYjlcdWQ3ODggXHViM2Q5XHVjODA0XHVjNWQwIFx1YWQwMFx1YzJlY1x1Yzc3NCBcdWM4ODAgXHVjNzg4XHVjNWI0XHVjMTFjIFx1YjNkOVx1YzgwNFx1Yzc0NCBcdWM1ZWNcdWI3ZWMgXHVhYzFjIFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWIyZTQuIFx1YWRmOFx1YjdmMFx1YjM3MCBcdWIzZDlcdWM4MDRcdWM3NzQgXHVjNzkwXHVhZmI4IFx1Y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