d = [input() for i in range(5)]
p = [int(list(i)[-1]) for i in d]
if p.count(0) == 0:
  n = p.index(min(p))
else:
  q = sorted(p)
  while q.count(0) != 0:
    q.remove(0)
  m = q[0]
  n = p.index(m)
  
x = int(d[n])
del d[n]

for i in range(len(d)):
  if list(d[i])[-1] == "0":
    continue
  else:
    d[i] = int(d[i])
    d[i] = (int(d[i]/10)+1)*10
    
d = [int(num) for num in d]

print(sum(d)+x)