시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 473 98 69 24.731%

문제

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

찰리는 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
W3sicHJvYmxlbV9pZCI6IjIwOTEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIzZDlcdWM4MDQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1Y2MzMFx1YjlhY1x1YjI5NCBcdWIzYzhcdWM3NDQgXHVjODgwIFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWIyZTQuIFx1YWRmOFx1YjI5NCBcdWQyYjlcdWQ3ODggXHViM2Q5XHVjODA0XHVjNWQwIFx1YWQwMFx1YzJlY1x1Yzc3NCBcdWM4ODAgXHVjNzg4XHVjNWI0XHVjMTFjIFx1YjNkOVx1YzgwNFx1Yzc0NCBcdWM1ZWNcdWI3ZWMgXHVhYzFjIFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWIyZTQuIFx1YWRmOFx1YjdmMFx1YjM3MCBcdWIzZDlcdWM4MDRcdWM3NzQgXHVjNzkwXHVhZmI4IFx1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