import math
dish = [int(input()) for _ in range(5)]
sm = 9
smin = 0
for item in dish:
  r = item % 10
  if 1 <= r <= 9:
    if sm > r:
      sm = r
      smin = item
ans = 0    
for cnt, item in enumerate(dish):
  if cnt == smin:
    ans += item
  else:
    r = item % 10
    if 1 <= r <= 9:
      ans += item + 10 - r
    else:
      ans += item
print(ans)    