A=[]
ans=0
for i in range(5):
  A.append(int(input()))
s=0
for i in A:
  if i%10==0:
    ans+=i
    del A[s]
  s+=1
    
y=0
Max=0
for i in A:
  X=10-(i%10)
  if Max<=X:
    A[0],A[y]=A[y],A[0]
    Max=X
  y+=1

ans+=A[0]
A=A[1:]
for i in A:
  i+=10-(i%10)
  ans+=i
print(ans)