from heapq import heappop, heappush

n = int(eval(input()))

grid = [list(map(int, input().split())), list(map(int, input().split()))]





def biggest(grid, start, cost=0):

    dist = [[0 for _ in range(n)] for _ in range(2)]

    dx = [1, 0]

    dy = [0, 1]

    st = [(cost, start)]

    dist[start[0]][start[1]] = grid[start[0]][start[1]] + cost

    while(st):

        c, [sx, sy] = heappop(st)

        for a, b in zip(dx, dy):

            x = sx + a

            y = sy + b

            if x >= 2 or y >= n:

              continue

            dxy = dist[sx][sy] + grid[x][y]

            if dist[x][y] >= dxy:

                continue

            dist[x][y] = dxy

            heappush(st, (dist[x][y], [x, y]))

    return dist[-1][-1]





dist = biggest(grid, [0, 0], cost=0)

print(dist)
n = int(eval(input()))

grid = [list(map(int, input().split())), list(map(int, input().split()))]

dist = [[0 for _ in range(n)] for _ in range(2)]

dist[0][0] = grid[0][0]

for i in range(2):

  for j in range(n):

    if j < n - 1:

      dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])

    if i == 0:

      dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])

print((dist[-1][-1]))
from heapq import heappop, heappush

n = int(eval(input()))
grid = [list(map(int, input().split())), list(map(int, input().split()))]


def biggest(grid, start, cost=0):
    dist = [[0 for _ in range(n)] for _ in range(2)]
    dx = [1, 0]
    dy = [0, 1]
    st = [(cost, start)]
    dist[start[0]][start[1]] = grid[start[0]][start[1]] + cost
    while st:
        c, [sx, sy] = heappop(st)
        for a, b in zip(dx, dy):
            x = sx + a
            y = sy + b
            if x >= 2 or y >= n:
                continue
            dxy = dist[sx][sy] + grid[x][y]
            if dist[x][y] >= dxy:
                continue
            dist[x][y] = dxy
            heappush(st, (dist[x][y], [x, y]))
    return dist[-1][-1]


dist = biggest(grid, [0, 0], cost=0)
print(dist)

n = int(eval(input()))
grid = [list(map(int, input().split())), list(map(int, input().split()))]
dist = [[0 for _ in range(n)] for _ in range(2)]
dist[0][0] = grid[0][0]
for i in range(2):
    for j in range(n):
        if j < n - 1:
            dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])
        if i == 0:
            dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])
print((dist[-1][-1]))

-from heapq import heappop, heappush - - - -def biggest(grid, start, cost=0): -    dist = [[0 for _ in range(n)] for _ in range(2)] -    dx = [1, 0] -    dy = [0, 1] -    st = [(cost, start)] -    dist[start[0]][start[1]] = grid[start[0]][start[1]] + cost -    while st: -        c, [sx, sy] = heappop(st) -        for a, b in zip(dx, dy): -            x = sx + a -            y = sy + b -            if x >= 2 or y >= n: -                continue -            dxy = dist[sx][sy] + grid[x][y] -            if dist[x][y] >= dxy: -                continue -            dist[x][y] = dxy -            heappush(st, (dist[x][y], [x, y])) -    return dist[-1][-1] - - -dist = biggest(grid, [0, 0], cost=0) -print(dist) +dist = [[0 for _ in range(n)] for _ in range(2)] +dist[0][0] = grid[0][0] +for i in range(2): +    for j in range(n): +        if j < n - 1: +            dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1]) +        if i == 0: +            dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j]) +print((dist[-1][-1]))