def RodCutting(larr, parr, L):
    n = len(larr)
    dp = [[0 for j in range((L + 1))] for i in range((n + 1))]
    for i in range(1, (n + 1)):
        for j in range(1, (L + 1)):
            if (larr[(i - 1)] <= j):
                dp[i][j] = max((parr[(i - 1)] + dp[i][(j - larr[(i - 1)])]), dp[(i - 1)][j])
            else:
                dp[i][j] = dp[(i - 1)][j]
    print(dp)
    return dp[n][L]
def RodCutting(larr, parr, L):
    n = len(larr)
    dp = [[0 for j in range((L + 1))] for i in range((n + 1))]
    for i in range(1, (n + 1)):
        for j in range(1, (L + 1)):
            if (larr[(i - 1)] <= j):
                dp[i][j] = max((parr[(i - 1)] + dp[i][(j - larr[(i - 1)])]), dp[(i - 1)][j])
            else:
                dp[i][j] = dp[(i - 1)][j]
    print(dp)
    return dp[n][L]