a=[]
b=[]
for i in range(0,5):
    a.append(int(input()))
    b.append(int(a[i]%10))

for i in range(0,5):
    for j in range(0,5):
        if b[i]<b[j]:
            m=b[i]
            b[i]=b[j]
            b[j]=m

for i in range(0,5):
    if b[i]!=0:
        k=i
        break
    else:
        continue

s=0
for i in range(0,5):
    if i==k:
        continue
    elif b[i]==0:
        s=s+a[i]
    else:
        s=s+a[i]+10-b[i]

s=s+a[k]
print(s)

