t = [int(input()) for _ in range(5)]
ans = 0
min_b = 100
for i in range(5):
  a = t[i]//10
  b = t[i]%10
  if b == 0:
    ans += a
  else:
    if min_b > b:
      min_b = b
    ans += a+1
print(ans*10 - (10-min_b))