cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in range(5):
    if cook[i]%10 < mn and cook[i]%10!=0:
        ans = i
for i in range(5):
    if i==ans:
        continue
    else:
        if cook[i]%10==0:
            time += cook[i]
        else:
            time += cook[i] + 10-(cook[i]%10)
    print(time)
time += cook[ans]
print(time)