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

ans = 0
tmp = []

for i in range(len(L)):
    if(L[i]%10 == 0):
        ans += L[i]
    else:
        ans += L[i] + (10 - L[i]%10)
        tmp.append(L[i]%10)

ans -= min(tmp)

print(ans)
