CodeEff/ECCO huggingface dataset:
# Original solution
def genSumList(l):
        n = len(l)
        ret = []
        for i in range(1,n+1):
                tmp = 0
                for j in range(i):
                        tmp += l[j]
                ret.append(tmp)
        return ret

n = int(eval(input()))
a = []
ans = []

for i in range(2):
        a.append(list(map(int, input().split())))

sum1 = genSumList(a[0])
sum2 = genSumList(a[1][::-1])

for i in range(n):
        ans.append(sum1[i] + sum2[(i+1)*(-1)])
print((max(ans)))

# Optimized solution
n = int(eval(input()))
a = []
for i in range(2):
    a.append(list(map(int, input().split())))

l = []

for i in range(1,n):
    l.append(sum(a[0][:i]) + sum(a[1][i-1:]))

if len(l) == 0:
    print((a[0][0] + a[1][0]))
    exit()
print((max(l)))
# Original solution
length = int(eval(input()))
first = input().split(" ")
second = input().split(" ")
i = 0
sweet = 0
sugars = 0
while i < length:
    j = i
    k = 0
    while k<=i:
        sweet = sweet + int(first[k])
        k = k + 1
    while j < length:
        sweet = sweet + int(second[j])
        j = j + 1
    if sweet > sugars:
        sugars = sweet
    sweet = 0
    i = i + 1
print(sugars)

# Optimized solution
n = int(input())
t = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]

mina = None
tot = sum(t) + sum(b)
tn = sum(t) - t[0]
bn = 0
for s in range(n):
 if mina == None or mina > tn + bn:
  mina = tn + bn
 if s == n-1:
  break
 tn -= t[s+1]
 bn += b[s]

print(tot - mina)
# Original solution
#!/usr/bin/env python3
import sys


def dfs(x:int, y:int):
    
    if(y == 1 and x == (N-1)):
        return A[y][x]

    elif(y > 1 or x > N-1):
        return 0
    else:
        return max(dfs(x+1, y), dfs(x, y+1)) + A[y][x]
    
    
def solve(N: int, A: "List[List[int]]"):
    print((dfs(0,0)))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    global N, A
    N = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(N)] for _ in range(2)]  # type: "List[List[int]]"
    solve(N, A)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[List[int]]"):
    ans = 0
    for i in range(0,N):
        ans = max(sum(A[0][:i+1])+sum(A[1][i:]), ans)

    print(ans)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(N)] for _ in range(2)]  # type: "List[List[int]]"
    solve(N, A)

if __name__ == '__main__':
    main()
# Original solution
def main():
    n = int(eval(input()))
    matrix = []
    matrix.append([int(num) for num in input().split()])
    matrix.append([int(num) for num in input().split()])
    # RE:  matrix = [int(num) for num in (input().split() for i in range(2))]

    candies = [sum(matrix[0][:d+1]) + sum(matrix[1][d:]) for d in range(n)]
    print((max(candies)))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    n = int(eval(input()))
    matrix = [[int(num) for num in input().split()] for _ in range(2)]

    candies = [sum(matrix[0][:d+1]) + sum(matrix[1][d:]) for d in range(n)]
    print((max(candies)))


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = [[int(i) for i in input().split()] for _ in range(2)]

# dpj[i]: (i,j)でアメの最大値
dp1 = [0] * N
dp2 = [0] * N

# 初期条件
dp1[0] = A[0][0]
dp2[0] = A[0][0] + A[1][0]

# 貰うdp
for i in range(1,N):
    dp1[i] = dp1[i-1] + A[0][i]

for i in range(1,N):
    dp2[i] = max(dp1[i], dp2[i-1]) + A[1][i]

print((dp2[-1]))

# Optimized solution
N = int(eval(input()))
A = [[0] + [int(i) for i in input().split()] for _ in range(2)]

for i in range(N):
    A[0][i+1] += A[0][i]
    A[1][i+1] += A[1][i]

ans = 0
for i in range(1,N+1):
    ans = max(ans, A[0][i] + (A[1][-1] -A[1][i-1]))

print(ans)
# Original solution
n = int(eval(input()))
a = list(list(map(int, input().split())) for _ in range(2))
ans = 0
for x in range(n):
    buf = 0
    for i in range(x + 1):
        buf += a[0][i]
    for j in range(x, n):
        buf += a[1][j]
    ans = max(ans, buf)
print(ans)

# Optimized solution
def main():
    N = int(eval(input()))
    A = [list(map(int, input().split())) for _ in range(2)]

    dp = [[0] * N for _ in range(2)]
    dp[0][0] = A[0][0]

    for r in range(2):
        for c in range(N):
            if r != 0:
                dp[r][c] = max(dp[r - 1][c] + A[r][c], dp[r][c])
            if c != 0:
                dp[r][c] = max(dp[r][c - 1] + A[r][c], dp[r][c])
    print((dp[1][N - 1]))


if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
maxi=0
for i in range(n):
    total=0
    x=sum(a[:i+1])
    y=sum(b[i:])
    total=x+y
    maxi=max(total,maxi)
print(maxi)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
import itertools as it
ac_a=list(it.accumulate(a))
ac_b=list(it.accumulate(b))
sum_b=sum(b)
ans=0
for i in range(n):
    if i>0:
        tmp=ac_a[i]+sum_b-ac_b[i-1]
    elif i==0:
        tmp=a[0]+sum_b
    ans=max(tmp,ans)
print(ans)
# Original solution
n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(2)]

ans = 0
for i in range(n):
  s = sum(a[0][0:i+1]) + sum(a[1][i:])
  ans = max(ans, s)
  
print(ans)

# Optimized solution
n=int(eval(input()))
a=[list(map(int,input().split())) for i in range(2)]
ans=0
if n==1:
  print((sum(a[0])+sum(a[1])))
  exit()
for i in range(n):
  ans=max(ans,sum(a[0][0:i])+sum(a[1][i-1:n]))
print(ans)
# Original solution
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = [[int(a) for a in input().split()] for _ in range(2)]
    move = ((1, 0), (0, 1))
    maxN = [[0 for _ in range(N)] for i in range(2)]
    q = deque()
    q.append((0, 0, A[0][0]))
    while q:
        nx, ny, np = q.popleft()
        maxN[nx][ny] = max(maxN[nx][ny], np)
        for dx, dy in move:
            if 0 <= nx + dx < 2 and 0 <= ny + dy < N:
                q.append((nx + dx, ny + dy, maxN[nx][ny] + A[nx + dx][ny + dy]))
    print((maxN[1][N - 1]))


    return 0

if __name__ == "__main__":
    solve()

# Optimized solution
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = [[int(a) for a in input().split()] for _ in range(2)]
    M = ((1, 0), (0, 1))
    q = deque()
    q.append((0, 0, 0))
    C = [[0] * N for _ in range(2)]
    while q:
        i, j, n = q.popleft()
        if n + A[i][j] > C[i][j]:
            C[i][j] = n + A[i][j]
            for di, dj in M:
                if 0 <= i + di < 2 and 0 <= j + dj < N:
                    q.append((i + di, j + dj, C[i][j]))
    print((C[1][N-1]))


    return 0

if __name__ == "__main__":
    solve()
# Original solution
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = [[int(a) for a in input().split()] for _ in range(2)]
    M = ((1, 0), (0, 1))
    q = deque()
    q.append((0, 0, 0))
    C = [[0] * N for _ in range(2)]
    while q:
        i, j, n = q.popleft()
        if n + A[i][j] > C[i][j]:
            C[i][j] = n + A[i][j]
            for di, dj in M:
                if 0 <= i + di < 2 and 0 <= j + dj < N:
                    q.append((i + di, j + dj, C[i][j]))
    print((C[1][N-1]))


    return 0

if __name__ == "__main__":
    solve()

# Optimized solution
import sys


def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = [[int(a) for a in input().split()] for _ in range(2)]
    first = [0] * N
    second = [0] * N
    first[0] = A[0][0]
    second[N-1] = A[1][N-1]
    for i in range(1, N):
        first[i] = first[i-1] + A[0][i]
        second[N - 1- i] = second[N - i] + A[1][N - 1- i]    
    maxPoint = 0
    for i in range(N):
        maxPoint = max(maxPoint, first[i] + second[i])
    print(maxPoint)

    return 0

if __name__ == "__main__":
    solve()
# Original solution
N = int(eval(input()))
A = [list(map(int, input().split())) for k in range(2)]
ans = 0

for k in range(N):
    ans = max(ans,sum(A[0][0:k+1])+sum(A[1][k:]))
print(ans)


# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for k in range(N):
    ans = max(ans,sum(A[:k+1])+sum(B[k:]))
print(ans)
# Original solution
n = int(eval(input()))
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[i] = a1[0:i+1] + a2[i::]
  ans[i] = sum(ans[i])
print((max(ans)))

# Optimized solution
n = int(eval(input()))
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[i] = sum(a1[0:i+1]) + sum(a2[i::])
print((max(ans)))
# Original solution
n = int(eval(input()))
field = [list(map(int, input().split())) for i in range(2)]
for i in range(n - 1):
	field[0][i + 1] += field[0][i]
field[1][0] += field[0][0]
for i in range(n - 1):
	field[1][i + 1] += max(field[0][i + 1], field[1][i])
print((field[1][n - 1]))

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
maxv = 0
for i in range(n):
	maxv = max(maxv, (sum(A[:i+1]) + sum(B[i:])))
print(maxv)
# Original solution
n = int(eval(input()))

input_data = {}

for r in range(2):
    line_data = [int(x) for x in input().split(" ")]
    for c, value in enumerate(line_data):
        input_data[(r, c)] = value

from collections import defaultdict
answer = defaultdict(int)


#for c, value in enumerate(range(n)):
#    answer[(0,c)] = input_data[(0, c)] + answer[(0,c - 1)]

for r in range(2):
    for c, value in enumerate(range(n)):
        answer[(r,c)] = input_data[(r, c)] + max(answer[(r,c - 1)], answer[(r - 1, c)] )


print((answer[(1,n-1)]))


# Optimized solution
#■標準入力ショートカット

def get_next_int():
    return int(float(eval(input())))
def get_next_str():
    return eval(input())

def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])
def get_next_strs(delim=" "):
    return tuple(input().split(delim))

def get_next_by_types(*value_types,delim=" "):
    return tuple([t(x) for t, x in zip(value_types,input().split(delim))])

def main():
    n = get_next_int()
    from collections import defaultdict
    data = defaultdict(int)
    
    for i in range(2):
        for j, value in enumerate(get_next_ints()):
            data[(i,j)] = value
    
    max_get = defaultdict(int)
    
    for i in range(2):
        for j in range(n):
            max_get[(i,j)] = data[(i,j)] + max(max_get[(i-1,j)],max_get[(i,j-1)])
    
    return max_get[(1,n-1)]


if __name__ == '__main__':
    print((main()))
# Original solution
n,*l=list(map(int,open(0).read().split()))
a=l[:n];b=l[n:]
r=t=a[0]+sum(b)
for i,j in zip(a[1:],b):
	t+=i-j
	r=max(r,t)
print(r)

# Optimized solution
n,*l=list(map(int,open(0).read().split()));print((max(sum(l[:i+1]+l[n+i:])for i in range(n))))
# Original solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = [0] * n
for i in range(n):
    ans[i] = sum(a1[:i+1]) + sum(a2[i:])

print((max(ans)))

# Optimized solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans = max(ans, sum(a1[:i+1]) + sum(a2[i:]))

print(ans)
# Original solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

for i in range(1, n):
    a1[i] += a1[i - 1]

for i in range(n - 2, -1, -1):
    a2[i] += a2[i + 1]

res = 0
for i in range(n):
    tmp = a1[i] + a2[i]
    res = max(tmp, res)

print(res)


# Optimized solution
n = int(eval(input()))
dp = [[0 for i in range(n)] for i in range(2)]
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

dp[0][0] = a1[0]
for i in range(1, n):
    dp[0][i] = dp[0][i - 1] + a1[i]
dp[1][0] = dp[0][0] + a2[0]

for i in range(1, n):
    dp[1][i] = max(dp[0][i] + a2[i], dp[1][i - 1] + a2[i])

print((dp[1][-1]))
# Original solution
n=int(eval(input()))
a=[list(map(int, input().split())) for _ in range(2)]
result=[]
for i in range(n):
  total = 0
  for j in range(i+1):
    total = total + a[0][j]
  for m in range(i, n):
    total = total + a[1][m]
  result.append(total)
print((max(result)))

# Optimized solution
N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(2)]

maximum = 0
for i in range(N):
  result = 0
  result += sum(A[0][0:i+1])
  result += sum(A[1][i:N])  
  maximum = result if maximum < result else maximum
print(maximum)
# Original solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

l = []
cnt = 0
for i in range(1,n+1):
    cnt = sum(a1[:i])+sum(a2[i-1:])
    l.append(cnt)
    cnt = 0
print((max(l)))


# Optimized solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

total = sum(a2)+a1[0]
ans = total
for i in range(1, n):
    total = total + a1[i] - a2[i-1]
    ans = max(ans, total)

print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = []

for n in range(N):
  ans+=[sum(A[:n+1])+sum(B[n:])]

print((max(ans)))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
print((max(sum(A[:n+1]+B[n:]) for n in range(N))))
# Original solution
N = int(eval(input()))
s1 = list(map(int,input().split()))
s2 = list(map(int,input().split()))

ans = 0
for i in range(N):
    tmp = sum(s1[:i+1]) + sum(s2[i:])
    ans = max(ans, tmp)
print(ans)

# Optimized solution
N = int(eval(input()))
S0 = list(map(int,input().split()))
S1 = list(map(int,input().split()))

ans = 0
for i in range(N):
    tmp = sum(S0[:i+1]) + sum(S1[i:])
    ans = max(tmp,ans)
print(ans)
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
for i in range(n):
  cnt = sum(A[:i+1]) + sum(B[i:])
  ans = max(ans, cnt)
print(ans)

# Optimized solution
n = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

ans = 0
for i in range(n):
  ans = max(ans, sum(A1[:i+1]) + sum(A2[i:]))
print(ans)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0 for i in range(n)] for j in range(2)]
dp[0][0]=a[0]
for i in range(1,n):
    dp[0][i]=a[i]+dp[0][i-1]
dp[1][0]=dp[0][0]+b[0]
for i in range(1,n):
    dp[1][i]=max(dp[0][i],dp[1][i-1])+b[i]
print((dp[1][n-1]))



# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
    z=0
    for j in range(i+1):
        z+=a[j]
    for j in range(i,n):
        z+=b[j]
    ans=max(ans,z)
print(ans)
# Original solution
res = 0
n = int(eval(input()))
a = [list(map(int,input().split())) for _ in range(2)]
# したにいくます
for i in range(n):
    t = 0
    tmp = 0
    for j in range(n):
        tmp += a[t][j]
        if i==j:
            t += 1
            tmp += a[t][j]
    res = max(res,tmp)
print(res)


# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))

res = 0
for i in range(n):
    tmp = 0
    for j in range(i + 1):
        tmp += a[j]
    for j in range(i, n):
        tmp += b[j]
    res = max(res, tmp)
print(res)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = max(ans,sum(a[:i+1])+sum(b[i:]))
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = max(ans,sum(a[:n-i])+sum(b[n-1-i:]))
print(ans)
# Original solution
N = int(eval(input()))
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
ans = 0
for i in range(N):
  tmp = sum(A1[0:i+1])
  tmp = tmp + sum(A2[i:N])
  ans = max(ans,tmp)
print((str(ans)))

# Optimized solution
N = int(eval(input()))
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
ans = 0
for i in range(N):
    ans = max(sum(A1[0:i+1]) + sum(A2[i:N]) , ans)
print((str(ans)))
# Original solution
n,mat = input(),[ list(map(int,input().split())) for i in range(2)]
def f(mat,i,j):
	if i<0 or j <0:
		return -float('inf')
	if i == 0 and j == 0:
		return mat[i][j] 
	return mat[i][j] + max(f(mat,i-1,j),f(mat,i,j-1))
print(f(mat,1,len(mat[0])-1))

# Optimized solution
n,mat = input(),[ list(map(int,input().split())) for i in range(2)]
mem = {}
def f(mat,i,j):
	if i<0 or j <0: return -float('inf')
	if i == 0 and j == 0: return mat[i][j] 
	if (i,j) not in mem:
		mem[(i,j)] =  mat[i][j] + max(f(mat,i-1,j),f(mat,i,j-1))
	return mem[(i,j)]
print(f(mat,1,len(mat[0])-1))
# Original solution
N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
sum = 0

for i in range(len(A1)-1):
    temp = 0
    for j, (k, l) in enumerate(zip(A1[1:], A2[:-1])):
        if j >= i:
            temp += l
        else: 
            temp += k
    sum = max(sum, temp)

print((sum + A1[0] + A2[-1]))

# Optimized solution
N = int(eval(input()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = 0

for i in range(N):
    ans = max(ans, sum(A1[0:i+1] + A2[i:]))

print(ans)
# Original solution
n = int(eval(input()))
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))

ans = 0
for i in range(n):
    total = 0
    num = i
    while num >= 0:
        total += c1[num]
        num -= 1
    for j in range(i,n):
        total += c2[j]
    ans = max(ans, total)
print(ans)


# Optimized solution
n = int(eval(input()))
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans = max(ans, sum(c1[:i+1] + c2[i:]))

print(ans)
# Original solution
N = int(eval(input()))
As = []
As.append(list(map(int,input().split())))
As.append(list(map(int,input().split())))

sums = [[-1 for _ in range(N)],[-1 for _ in range(N)]]
sums[0][0] = As[0][0]

for r in range(2):
	for c in range(N):
		if r < 2-1 and sums[r+1][c] < As[r+1][c] + sums[r][c]:
			sums[r+1][c] = As[r+1][c] + sums[r][c]
			
		if c < N-1 and sums[r][c+1] < As[r][c+1] + sums[r][c]:
			sums[r][c+1] = As[r][c+1] + sums[r][c]
			
print((sums[1][N-1]))

# Optimized solution
N = int(eval(input()))

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

As = [[0 for _ in range(N+1)] for _ in range(3)]
for r in range(2):
	for c in range(N):
		As[r][c] = tmps[r][c]
		
#print(As)

sums = [[-1 for _ in range(N+1)] for _ in range(3)]
sums[0][0] = As[0][0]

for r in range(2):
	for c in range(N):
		if sums[r+1][c] < As[r+1][c] + sums[r][c]:
			sums[r+1][c] = As[r+1][c] + sums[r][c]
			
		if sums[r][c+1] < As[r][c+1] + sums[r][c]:
			sums[r][c+1] = As[r][c+1] + sums[r][c]
			
		#print(sums)
			
print((sums[1][N-1]))
# Original solution
N = int(eval(input()))
x = list(map(int, input().split(' ')))
y = list(map(int, input().split(' ')))

count = x[0]
for i in range(N):
    count += y[i]

sums = count
for i in range(N - 1):
    count = count + x[i + 1] - y[i]
    if count > sums:
        sums = count

print(sums)

# Optimized solution
N = int(eval(input()))
x = list(map(int, input().split(' ')))
y = list(map(int, input().split(' ')))

def down_count():
    count = x[0]
    for i in range(N):
        count += y[i]
    return count

x_list = []

def switch_count():
    for i in range(N - 1):
        sums = x_list[i] + x[i + 1] - y[i]
        x_list.append(sums)

down_sum = down_count()
x_list.append(down_sum)
switch_count()
x_list.sort(reverse=True)
print((x_list[0]))
# Original solution
def c_Candies(N, A):
    dp = [[0] * N for _ in range(2)]
    dp[0][:] = A[0][:]
    dp[1][0] = A[0][0] + A[1][0]
    for i in range(2):
        for j in range(1, N):
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + A[i][j]
    return dp[1][-1]

N = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(2)]
print((c_Candies(N, A)))

# Optimized solution
def c_Candies(N, A):
    # dp[i][j]は最もアメが取れるようにi行j列まで進んだときのアメの獲得数
    dp = [[0] * N for _ in range(2)]

    # 1行目の値と、2行1列の値は先に計算できる
    dp[0][0] = A[0][0]
    dp[1][0] = dp[0][0] + A[1][0]
    for j in range(1, N):
        dp[0][j] = dp[0][j - 1] + A[0][j]

    for j in range(1, N):
        # 2行j+1列の値は、その左か上のうち小さくない値にそのマスのアメの個数を足す
        dp[1][j] = max(dp[0][j], dp[1][j - 1]) + A[1][j]
    return dp[1][-1]

N = int(eval(input()))
A = [[int(i) for i in input().split()] for j in range(2)]
print((c_Candies(N, A)))
# Original solution
from itertools import accumulate
n = int(eval(input()))
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
a1 = list(accumulate(A1))
ans = 0
for i in range(n):
  sums = a1[i]
  A3 = A2[i:]
  a2 = list(accumulate(A3))
  sums += max(a2)
  ans = max(ans,sums)
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans = max(ans,sum(a[:i+1])+sum(b[i:]))
print(ans)
# Original solution
from itertools import accumulate
n=int(eval(input()))
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a2=[0]+a2
a1=list(accumulate(a1))
a2=list(accumulate(a2))
ans=0
s=a2[-1]
for i in range(n):
    t=0
    t+=a1[i]
    t+=s-a2[i]
    ans=max(t,ans)
print(ans)

# Optimized solution
n=int(eval(input()))
a1=list(map(int,input().split()))
a2=[0]+list(map(int,input().split()))
from itertools import accumulate
a1=list(accumulate(a1))
a2=list(accumulate(a2))
ans=0
for i in range(n):
  t=a1[i]+a2[-1]-a2[i]
  ans=max(ans,t)
print(ans)
# Original solution
while True:
    try:
        n = int(eval(input()))
        count = 0
        for a in range(0,10):
            for b in range(0,10):
                for c in range(0,10):
                    for d in range(0,10):
                        if a+b+c+d==n:
                            count+=1
        print(count)
    except:
        break

# Optimized solution
from itertools import product
while True:
    try:
        n = int(eval(input()))
    except:
        break
    print((sum(a+b+c+d==n for a,b,c,d in product(list(range(10)), repeat=4))))
# Original solution
import sys,itertools
k=list(range(10))
for l in sys.stdin:print([sum(x)for x in list(itertools.product(k,k,k,k))].count(int(l)))

# Optimized solution
import sys
def f(s,d,g,c):
	if d>3:return c
	for n in range(10):
		if s+n==g:return c+1
		elif s+n>g:return c
		else:c=f(s+n,d+1,g,c)
	return c
for l in sys.stdin:
	print(f(0,0,int(l),0))
# Original solution
import sys
def f(s,d,g,c):
	if d>3:return c
	for n in range(10):
		if s+n==g:return c+1
		elif s+n>g:return c
		else:c=f(s+n,d+1,g,c)
	return c
for l in sys.stdin:
	print(f(0,0,int(l),0))

# Optimized solution
import sys
r=list(range(10))
x=[0]*51
for a in r:
	for b in r:
		for c in r:
			for d in r:
				x[a+b+c+d]+=1
for l in sys.stdin:
	print(x[int(l)])
# Original solution
import sys,itertools
k=range(10)
s=[0]*51
for n in [sum(x)for x in list(itertools.product(k,k,k,k))]:s[n]+=1
for l in sys.stdin:print(s[int(l)])

# Optimized solution
import sys
s=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				s[a+b+c+d]+=1
for l in sys.stdin:print(s[int(l)])