mlist = [int(input()) for i in range(5)]
minmin = 10
for i in mlist:
  if i%10 != 0:
    minmin = min(minmin,i%10)
ans = 0
for i in mlist:
  ans += (i//10 +1)*10
ans = ans + minmin - 10
print(ans)
  
  