<s>[INST] def burst_balloons(points, N):
    dp = [[0 for _ in range(N)] for _ in range(N)]
    for left in range(N - 2, -1, -1):
        for right in range(left + 2, N):
            for i in range(left + 1, right):
                dp[left][right] = max(dp[left][right], points[left] * points[i] * points[right] + dp[left][i] + dp[i][right])
    return dp[0][N - 1]

points = [3, 1, 5, 8]
N = len(points)
print(burst_balloons(points, N))[/INST]