L=[int(input()) for i in range(5)]
A=L[0]%10
B=L[1]%10
C=L[2]%10
D=L[3]%10
E=L[4]%10
X=max(A,B,C,D,E)
A1=L[0]+A//10
B1=L[1]+B//10
C1=L[2]+C//10
D1=L[3]+D//10
E1=L[4]+E//10
ans=A1+B1+C1+D1+E1-X
print(ans)