import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
minimum=min(li)
ans=0
for i in l:
  if i != l[li.index(minimum)]:
    ans+=math.ceil(i/10)*10
  else:
    ans+=i
print(ans)