l = list([int(input()) for _ in range(5)])

ans = 0

for i in range(len(l)):
  if ans % 10 == 0:
    pass
  else:
    ans += 10 - (ans % 10)
  ans += l[i]
  
ml = []
for i in range(len(l)):
  ml.append(l[i] % 10)
  if ml[i] == 0:
    ml[i] = 10
  
ans -= min(ml)
print(ans)