L=[]
L2=[]
for i in range(5):
    I=int(input())
    L.append(I)
    L2.append(I%10)

result=0
for i in L:
    result+=i
    if result%10==0:
        continue
    for j in range(10):
        result+=1
        if result%10==0:
            break

if min(L2)==0:
    for t in sorted(L2):
        if t==0:
            pass
        else:
            mn=t
            break
else:
    mn=min(L2)

print(result-(10-mn))
