f=[]
t=[]
r=[0]
for i in range(5):
    f.append(int(input()))
for i in range(5):
    if f[i]%10!=0:
        r.append(10-f[i]%10)
        t.append((f[i]//10+1)*10)
    else:
        t.append(f[i])
print(sum(t)-max(r))
