l = list(int(input()) for i in range(5))
A=[]
sum1=0
sum2=0

for i in range(5):
    if l[i]%10 == 0:
        A.append(0)
    else:
        A.append(10-(l[i]%10))
    
if A[0]==A[1]==A[2]==A[3]==A[4]==0:
    print(sum1 = l[0]+l[1]+l[2]+l[3]+l[4])
else:
    for k in range(5):
        sum2 += l[k]+A[k]
    print(sum2-max(A))