L = [int(input()) for i in range(5)]
l = [i*(-1)//10*10*(-1) for i in L]
l1 = [i%10 for i in L]
l2 = sorted(list(set(l1)))
if l2[0] == 0:
  print(sum(l)-l[l1.index(l2[1])]+L[l1.index(l2[1])])
else:
  print(sum(l)-l[l1.index(l2[0])]+L[l1.index(l2[0])])