x = []

for i in range(5):
  x.insert(0, int(input()))
  if x[i]%10 != 0:
    x[i], x[0] = x[0], x[i]

for i in range(len(x)):
  for j in range(len(x)-1):
    if 10 - x[j]%10 > 10 - x[j+1]%10:
      if x[j]%10 != 0 and x[j+1]%10 != 0:
        x[j], x[j+1] = x[j+1], x[j]

ans = 0
for i in range(5):
  if i == 4:
    ans += x[i]
  else:
    if x[i] % 10 == 0:
      ans += x[i]
    else:
      ans += (x[i] // 10 + 1 ) * 10

print(ans)

