A=[]
for i in range(5):
    B=int(input())
    A.append(B)
min=1000
for j in range(5):
    if A[j]%10!=0 and A[j]%10<min:
        min=A[j]%10
        index=j
time=0
for k in range(len(A)):
    if k!=index:
        time=time+A[k]
        if A[k]%10!=0:
            time=time+(10-A[k]%10)
    else:
        time=time+A[k]
print(time)
