list=[]
ans=10
sum=0
for i in range(5):
    list.append(int(input()))
for i in range(5):
    if list[i]%10<ans and list[i]%10!=0:
        ans=list[i]%10
for j in range(5):
    if list[j]%10!=0:
        sum+=list[j]+(10-list[j]%10)
    else:
        sum+=list[j]
    print(sum)
print(sum-(10-ans))