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

import math
ans = 0
minmod = 10
for i in range(n):
  if time[i]%10!=0:
    minmod = min(minmod,time[i]%10)
  else:
    minmod = min(minmod,10)
  ans += math.ceil(time[i]/10)*10

ans -= (10-minmod)
print(ans)
