l =list(int(input()) for i in range(5))
a =[]
time = 0
for i in range(5):
  a.append(l[i]%10)
#print(a)
b = a.index(min(a))
#print(b)
for i in range(5):
  time += (-(-l[i]//10))*10
time -= (-(-l[b]//10)*10) - l[b]
print(time)
