l = [int(input()) for i in range(5)]
time = 0
for v in l:
  if v %10 == 0:
    time += v
    l.remove(v)
if l != []:
  m = min(list(map(lambda x:x%10,l)))
  find_min = False
  for v in l:
    if v %10 == m and not find_min:
      time += v
    else:
      time += calc_time(v)
print(time)

def calc_time(t):
  return (int(t/10)+1 )*10

