lis = []
for _ in range(5):
  lis.append(int(input()))
mod = []
for i in lis:
  mod.append(i%10)
k = min(mod) if min(mod) != 0 else sorted(set(mod))[1]
ans = 0
for i in range(5):
  if i == mod.index(k):
    ans += lis[i]
  else:
    ans += ((lis[i]+9)//10)*10
print(ans)
    