a=[int(input()) for _ in range(5)]
b=0
c=[]
for i in range(5):
    if (b+a[i])%10==0:
        b+=a[i]
    else:
        b+=(a[i]//10+1)*10
for i in range(5):
    if a[i]%10!=0:
        c.append(a[i]%10)
print(b+min(c)-10)

