A,B,C,D,E=(int(input()) for _ in range(5))
X=[A,B,C,D,E]
time=0
rest=[]
for i in range(5):
    if X[i]%10!=0:
        time+=(X[i]//10+1)*10
    else:
        time+=X[i]
    rest.append(X[i]%10)
if min(rest)==0:
    print(time)
else:
    time+=min(rest)-10
    print(time)