a=[int(input()) for i in range (5)]
m=[]
s=0
for i in range(5):
    x=a[i]%10
    if x!=0:
        s+=a[i]+10-x
    else:
        s+=a[i]
for k in range(5):
    y=a[k]%10
    b=s
    if y!=0:
        n=10-y
        b=s-n
        m.append(b)
    else:
        m.append(b)
print(min(m)