import itertools
dishes=[int(input()) for i in range(5)]
all_comb=list(itertools.permutations(dishes))
t_min=123*5
for comb in all_comb:
  t=0
  for i in range(4):
    t=int((t+comb[i]-1)/10)*10+10
  t=t+comb[4]
  if t < t_min:
    t_min=t
print(t_min)
