def max_sum_rectangular_grid(grid, n):
    if not grid or n <= 0:
        return 0

    # Convert 2 x n grid into 1D values where each column contributes
    # the maximum of its two cells, since both cannot be chosen together.
    arr = [max(grid[0][i], grid[1][i]) for i in range(n)]

    if n == 1:
        return arr[0]

    incl = arr[0]
    excl = 0

    for i in range(1, n):
        new_excl = max(incl, excl)
        incl = excl + arr[i]
        excl = new_excl

    return max(incl, excl)