L=[int(input()) for _ in range(5)]
sum=0
modL=[(L[i]-1)%10 for i in range(5)]
last = modL.index(min(modL))
for i in range(5):
    if L[i]%10==0:
        sum += L[i]
    else:
        sum += (int(L[i]//10)+1)*10
if last%10!=0:
    sum -= 10 - L[last]%10
print(sum)