a=[int(input()) for i in range(5)]
result=0
ans=0
x=9
for i in a:
    if i%10!=0:
        result+=(i//10+1)*10
    elif i==0:
        result+=i
    else:
        result+=i
for i in a:
    if i%10!=0:
        ans=i%10
        if ans<x:
            x=ans
print(result+x-10)