import math
l=[int(input()) for i in range(5)]
t=[]
for ll in l:
  t.append(math.ceil(t//10))
lis=[]
for i in range(5):
  lis.append(t[i]*10-l[i])
m=max(lis)
sum=0
for i in range(5):
  sum+=t[i]*10
print(sum-m)
  
