```python
def max_sum_rectangular_grid(grid, n):
    if n == 0:
        return 0

    # DP states represent the maximum sum up to the *previous* column,
    # ending in one of three states:
    # 1. sum_ending_none: No element was chosen from the previous column.
    # 2. sum_ending_top: The top element was chosen from the previous column.
    # 3. sum_ending_bottom: The bottom element was chosen from the previous column.

    # Initialize states for the first column (i=0).
    sum_ending_none = 0
    sum_ending_top = grid[0][0]
    sum_ending_bottom = grid[1][0]

    # Iterate from the second column to the end.
    for i in range(1, n):
        # Calculate the states for the current column `i` based on the
        # states of the previous column `i-1`.

        # Max sum ending at column `i` with no element chosen from it.
        # This is simply the maximum of any state from the previous column.
        current_sum_ending_none = max(
            sum_ending_none, sum_ending_top, sum_ending_bottom
        )

        # Max sum ending at column `i` with the top element chosen.
        # We cannot have chosen the top element from the previous column.
        current_sum_ending_top = grid[0][i] + max(
            sum_ending_none, sum_ending_bottom
        )

        # Max sum ending at column `i` with the bottom element chosen.
        # We cannot have chosen the bottom element from the previous column.
        current_sum_ending_bottom = grid[1][i] + max(
            sum_ending_none, sum_ending_top
        )

        # Update the states for the next iteration.
        sum_ending_none = current_sum_ending_none
        sum_ending_top = current_sum_ending_top
        sum_ending_bottom = current_sum_ending_bottom

    # The final answer is the maximum of the three possible states for the last column.
    return max(sum_ending_none, sum_ending_top, sum_ending_bottom)
```