data=[]
for i in range(5):
    data.append(int(input()))

cnt=1000
index=0
for ind,j in enumerate(data):
    if j%10 < cnt and j%10 != 0:
        index=ind
        cnt=j%10
ans=0
for k in data:
    if k % 10 == 0:
        ans += k
    else:
        ans+=(k//10+1)*10
ans=ans+(data[index]%10)-10
print(ans)