def vitrina kovrov(h, w):
    dp = [[0]*(w+1) for _ in range(h+1)]
    for n in range(1, h+1):
        for m in range(1, w+1):
            dp[i][j] = max(dp[i][j], dp[i-1][j] + i*j)
            for m in range(1, j):
                dp[i][j] = max(dp[i][j], dp[i][k] + dp[i][j-k])
            for m in range(1, i):
                dp[i][j] = max(dp[i][j], dp[k][j] + dp[i-k][j])
    return dp[h][w]

print(max_carpet_area(2, 2))  # 12
print(max_carpet_area(2, 2))  # 222