a = [int(input()) for i in range(5)] 
b=[]
c=[]
d=0
sum=0
for i in range(5):
  if a[i]%10==0:
    b.append(a[i])
    c.append(10) 
  else:
    b.append(a[i]+(10-(a[i]%10)))
    c.append(a[i]%10) 
for i in range(5):
  if c[i]!=min(c):
    sum+=b[i]
  else:
     d+=i
print(sum+a[d])