import math
lst = []
for i in range(5):
  lst.append(int(input()))
minu = 9
for j in range(5):
  if int(str(lst[j])[-1]) < minu and int(str(lst[j])[-1]) > 0:
    minu = int(str(lst[j])[-1])
    temp = lst[j]
lst.remove(temp)
time = 0
for k in range(4):
  time += int(math.ceil(lst[k]/10) * 10)
time += temp
print(time)