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