#B - Five Dishes(ABC123)
B=[]
C=[]
for i in range(5):
    S=int(input())
    if S%10==0:
        C.append(S)
    else:
        C.append(S+(10-S%10))
    if S%10!=0:
        B.append(S%10)
print(sum(C)-(10-min(B)))