l=[input() for i in range(5)]
a=[0, 0, 0, 0, 0]
e=9
for i in range(5):
  if e >= int(l[i][-1]) and not(int(l[i][-1]) == 0):
      a[4] = l[i]

l.remove(a[4])
l = [int(i) for i in l]
for j in range(4):
  while(not(int(l[j]) % 10 is 0)):
    l[j]+=1
  a[j] = int(l[j])
a[4] = int(a[4])
print(sum(a))
