A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
l=[A,B,C,D,E]
l0=[i%10 for i in l]
x=[]
for i in range(5):
    if l0[i]!=0:
        l[i]=(1+l[i]//10)*10 
        x.append(l0[i])
ans=sum(l)-10+min(x)
print(ans)