cuicine = [int(input()) for i in range(5)]

r = [c % 10 for c in cuicine if c % 10 != 0]

r = sorted(r)

# print(r)

rmin = 0

if r != []:
  rmin = r.pop(0)

ans = sum(cuicine)

for i in r:
  ans += 10 - i

print(ans)
