ans = 0
temp = -1
for i in range(5):
    cur = int(input())
    if cur%10==0:
        ans += cur
    else:
        ans += cur+10-cur%10
        if temp<10-cur%10:
            temp = 10-cur%10

ans -= temp

print(ans)
