# coding: utf-8
import numpy as np
input_lines = raw_input()
data = np.array([],dtype=int)
line = ""
for i in input_lines:
if i != " ":
line += i
if i == " ":
data = np.append(data, int(line))
line = ""
data = np.append(data, int(line))
nums = [1,5,10,50,100,500]
A = data[-1]
history = []
for i in range(len(nums)):
history.append(np.min([data[len(nums)-i-1], A//nums[len(nums)-i-1]]))
A -= np.min([data[len(nums)-i-1], A//nums[len(nums)-i-1]]) * nums[len(nums)-i-1]
for j in range(len(history)):
print str(history[len(history)-j -1]),
String-> Numerische Verarbeitung ist etwas mühsam
Recommended Posts