CodeEff/ECCO huggingface dataset:
# Original solution
A, B, C, X, Y = list(map(int, input().split()))
ans = 0
if A + B <= 2*C:
    ans = A*X + B*Y
else:
    ans += 2*C*min(X, Y)
    if X >= Y:
        ans += min(A, 2*C) * (X-Y)
    else:
        ans += min(B, 2*C) * (Y-X)

print (ans)


# Optimized solution
A,B,C,x,y = list(map(int,input().split()))
ans = 0
if A+B > 2*C:
    ans += min(x,y)*C*2
else:
    ans += x*A + y*B
    print(ans)
    exit()    

if x >= y:
    x -= y
    y = 0
    if A <2*C:
        ans += x*A
    else:
        ans += x*2*C    
else:
    y -= x
    x = 0
    if B < 2*C:
        ans += y*B
    else:
        ans += y*2*C
print(ans)
# Original solution
A, B, C, X, Y = list(map(int, input().split()))

ans = float('inf')
for k in range(0, 2 * max(X, Y) + 1, 2):
    i = max(X - k // 2, 0)
    j = max(Y - k // 2, 0)
    ans = min(ans, A * i + B * j + C * k)

print(ans)


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    A, B, C, X, Y = list(map(int, readline().split()))

    ans = INF
    for k in range(0, 2 * max(X, Y) + 1, 2):
        i = max(0, X - k // 2)
        j = max(0, Y - k // 2)
        if ans > A * i + B * j + C * k:
            ans = A * i + B * j + C * k

    print(ans)
    return


if __name__ == '__main__':
    main()
# Original solution
a,b,c,x,y=list(map(int,input().split()))
ans=float("inf")
for i in range(2*(max(x,y)+1)):
  p=i*c
  p+=max(x-i//2,0)*a
  p+=max(y-i//2,0)*b
  ans=min(p,ans)
print(ans)

# Optimized solution
a,b,c,x,y=list(map(int,input().split()))
ans=a*x+b*y
n=max(x,y)
for i in range(1,n+1):
  ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))
print(ans)
# Original solution
a,b,c,x,y=list(map(int,input().split()))
ans=a*x+b*y
n=max(x,y)
for i in range(1,n+1):
  ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))
print(ans)




# Optimized solution
a,b,c,x,y=list(map(int,input().split()))
ans1=a*x+b*y
ans2=2*c*max(x,y)
ans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))
print((min(ans1,ans2,ans3)))
# Original solution
# ABC95 C -Half and Half
a,b,c,x,y = list(map(float,input().split()))
ans = 0
if a+b > 2*c:
    while x != 0.0 and y != 0.0:
        ans += 2*c
        x -= 1.0
        y -= 1.0
        if y == 0.0:
            while x != 0.0:
                if a > 2*c:
                    ans += 2*c
                    x -= 1.0
                else:
                    ans += a
                    x -= 1.0
        if x == 0.0:
            while y != 0.0:
                if b > 2*c:
                    ans += 2*c
                    y -= 1.0
                else:
                    ans += b
                    y -= 1.0
else:
    ans += a*x + b*y
print((int(ans)))

    

# Optimized solution
a,b,c,x,y=list(map(int,input().split()))
ans=0
ans1=0

e=max(x,y)
ans1=e*(2*c)
if 2*c<a+b:
    d=min(x,y)
    ans+=c*(2*d)
    x-=d
    y-=d
else:
    ans=a*x+b*y
    x-=x
    y-=y
ans+=x*a
ans+=y*b
print((min(ans,ans1)))
# Original solution
a,b,c,x,y = list(map(int,input().split()))
ans = a*x + b*y
for i in range(max(x,y) + 1):
	money = max(0,(x-i)*a) + max(0,(y-i)*b) + 2*i*c
	if money <= ans:
		ans = money
print(ans)

# Optimized solution
a,b,c,x,y = list(map(int,input().split()))
if a + b >= 2*c:
	if x >= y:
		ans = 2*y*c + (x-y)*min(a,2*c)
	else:
		ans = 2*x*c + (y-x)*min(b,2*c)
else:
	ans = (x*a + y*b)
print(ans)
# Original solution
A, B, C, X, Y = list(map(int, input().split()))
ret = A * X + B * Y
x = 0
y = 0
c = 0
while (X + Y) * 2 > c :
    c += 2
    x += 1
    y += 1
    tmp = A * max(0, X - x) + B * max(0, Y - y) + c * C
    ret = min(ret, tmp)
print(ret)

# Optimized solution
A, B, C, X, Y = list(map(int, input().split()))
ret = A * X + B * Y
x = 0
y = 0
c = 0
while (X + Y) * 2 > c :
    c += 2
    x += 1
    y += 1
    ret = min(ret, A * max(0, X - x) + B * max(0, Y - y) + c * C)
print(ret)
# Original solution

def resolve():
    A, B, C, X, Y = list(map(int, input().split()))

    yen = 0
    if A - C + B - C > 0:
        yen += C * 2 * min(X, Y)

        minans = 10 ** 30
        rest = max(X, Y) - min(X, Y)
        for i in range(rest + 1):
            if X > Y:
                minans = min((C*2 * i + (rest - i) * A), minans)
            else:
                minans = min((C*2 * i + (rest - i) * B), minans)

        yen += minans

    else:
        yen = A * X + B * Y

    print(yen)


resolve()

# Optimized solution
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    a, b, c, x, y = list(map(int, input().split()))
    ans = 10 ** 10
    yen = 0
    if a + b > c * 2:
        yen += (c * 2 * min(x, y))
        x, y = x - min(x, y), y - min(x, y)

        if x > 0:
            yen += min(x * a, x * 2 * c)
        else:
            yen += min(y * b, y * 2 * c)

    else:
        yen += a * x + b * y
    print(yen)


resolve()
# Original solution
from heapq import heappop as pop
from heapq import heappush as push

INF = 10 ** 18

class edge:
  def __init__(self, to, cost):
    self.to = to
    self.cost = cost

#V, E, r = map(int,input().split())
N, M, K = list(map(int,input().split()))

G = [[] for i in range(N)]
#G[i]...頂点iからの辺list、(行き先、コスト)

d = [INF for i in range(N)]
#d[i]...スタートからみた頂点iまでの最短距離

def dijkstra(lst):
  que = []
  for s in lst:
    d[s] = 0
    push(que, (0,s))

  while len(que):
    p = pop(que)
    v = p[1]
    if (d[v] < p[0]):
      continue
    for i in range(len(G[v])):
      e = G[v][i]
      if d[e.to] > d[v] + e.cost:
        d[e.to] = d[v] + e.cost
        push(que, (d[e.to], e.to))

for i in range(M):
  s, t, c = list(map(int,input().split()))
  s -= 1
  t -= 1
  G[s].append(edge(t,c))
  G[t].append(edge(s,c))


lst =  [int(eval(input())) - 1 for i in range(K)]
dijkstra(lst)

anss = []
append = anss.append

for i in range(N):
  for e in G[i]:
    x = d[i] + d[e.to] + e.cost
    if x % 2:
      append(x // 2 + 1)
    else:
      append(x // 2)

print((max(anss)))


# Optimized solution
from heapq import heappop as pop
from heapq import heappush as push

def solve():
  
  INF = 10 ** 18
  
  class edge:
    def __init__(self, to, cost):
      self.to = to
      self.cost = cost
  
  N, M, K = list(map(int,input().split()))
  
  G = [[] for i in range(N)]
  #G[i]...頂点iからの辺list、(行き先、コスト)
  
  d = [INF for i in range(N)]
  #d[i]...スタートからみた頂点iまでの最短距離
  
  def dijkstra(lst):
    que = []
    for s in lst:
      d[s] = 0
      push(que, (0,s))
  
    while len(que):
      p = pop(que)
      v = p[1]
      if (d[v] < p[0]):
        continue
      for i in range(len(G[v])):
        e = G[v][i]
        if d[e.to] > d[v] + e.cost:
          d[e.to] = d[v] + e.cost
          push(que, (d[e.to], e.to))
  
  for i in range(M):
    s, t, c = list(map(int,input().split()))
    s -= 1
    t -= 1
    G[s].append(edge(t,c))
    G[t].append(edge(s,c))
  
  
  lst =  [int(eval(input())) - 1 for i in range(K)]
  dijkstra(lst)
  
  anss = []
  append = anss.append
  
  for i in range(N):
    for e in G[i]:
      x = d[i] + d[e.to] + e.cost
      if x % 2:
        append(x // 2 + 1)
      else:
        append(x // 2)
  
  print((max(anss)))

solve()
# Original solution
class Line:
    def __init__(self,p1,p2):
        if p1[1] < p2[1]:self.s=p2;self.e=p1
        elif p1[1] > p2[1]:self.s=p1;self.e=p2
        else:
            if p1[0] < p2[0]:self.s=p1;self.e=p2
            else:self.s=p2;self.e=p1
def dot(a,b):return a[0]*b[0] + a[1]*b[1]
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
def dif(a,b):return [x-y for x,y in zip(a,b)]
def InterSection(l,m):
    a = dif(l.e,l.s);b = dif(m.e,l.s);c = dif(m.s,l.s)
    d = dif(m.e,m.s);e = dif(l.e,m.s);f = dif(l.s,m.s)
    g = lambda a, b : cross(a,b)==0 and dot(a,b)>0 and dot(b,b)<dot(a,a)
    if g(a,b) or g(a,c) or g(d,e) or g(d,f):return True
    elif l.s == m.e or l.s == m.s or l.e == m.e or l.e == m.s:return True
    elif cross(a,b) * cross(a,c) >= 0 or cross(d,e) * cross(d,f) >= 0:return False
    else:return True

q = int(eval(input()))
for i in range(q):
    x0,y0,x1,y1,x2,y2,x3,y3 = [int(i) for i in input().split()]
    a = [x0,y0] ; b = [x1,y1] ; c = [x2,y2] ; d = [x3,y3]
    l1 = Line(a,b) ; l2 = Line(c,d)
    if InterSection(l1,l2):print((1))
    else:print((0))

# Optimized solution
class Line:
    def __init__(self,p1,p2):
        if p1[1] < p2[1]:self.s=p2;self.e=p1
        elif p1[1] > p2[1]:self.s=p1;self.e=p2
        else:
            if p1[0] < p2[0]:self.s=p1;self.e=p2
            else:self.s=p2;self.e=p1
def dot(a,b):return a[0]*b[0] + a[1]*b[1]
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
def dif(a,b):return [x-y for x,y in zip(a,b)]
def InterSection(l,m):
    a = dif(l.e,l.s);b = dif(m.e,l.s);c = dif(m.s,l.s)
    d = dif(m.e,m.s);e = dif(l.e,m.s);f = dif(l.s,m.s)
    g = lambda a, b : cross(a,b)==0 and dot(a,b)>0 and dot(b,b)<dot(a,a)
    if g(a,b) or g(a,c) or g(d,e) or g(d,f):return True
    elif l.s == m.e or l.s == m.s or l.e == m.e or l.e == m.s:return True
    elif cross(a,b) * cross(a,c) >= 0 or cross(d,e) * cross(d,f) >= 0:return False
    else:return True

q = int(eval(input()))
for i in range(q):
    x0,y0,x1,y1,x2,y2,x3,y3 = [int(i) for i in input().split()]
    a = [x0,y0] ; b = [x1,y1] ; c = [x2,y2] ; d = [x3,y3]
    l1 = Line(b,a) ; l2 = Line(d,c)
    if InterSection(l1,l2):print((1))
    else:print((0))
# Original solution
class Line:
    def __init__(self,p1,p2):
        if p1[1] < p2[1]:self.s=p2;self.e=p1
        elif p1[1] > p2[1]:self.s=p1;self.e=p2
        else:
            if p1[0] < p2[0]:self.s=p1;self.e=p2
            else:self.s=p2;self.e=p1
def dot(a,b):return a[0]*b[0] + a[1]*b[1]
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
def dif(a,b):return [x-y for x,y in zip(a,b)]
def InterSection(l,m):
    a = dif(l.e,l.s);b = dif(m.e,l.s);c = dif(m.s,l.s)
    d = dif(m.e,m.s);e = dif(l.e,m.s);f = dif(l.s,m.s)
    g = lambda a, b : cross(a,b)==0 and dot(a,b)>0 and dot(b,b)<dot(a,a)
    if g(a,b) or g(a,c) or g(d,e) or g(d,f):return True
    elif l.s == m.e or l.s == m.s or l.e == m.e or l.e == m.s:return True
    elif cross(a,b) * cross(a,c) >= 0 or cross(d,e) * cross(d,f) >= 0:return False
    else:return True

q = int(eval(input()))
for i in range(q):
    x0,y0,x1,y1,x2,y2,x3,y3 = [int(i) for i in input().split()]
    a = [x0,y0] ; b = [x1,y1] ; c = [x2,y2] ; d = [x3,y3]
    l1 = Line(b,a) ; l2 = Line(d,c)
    if InterSection(l1,l2):print((1))
    else:print((0))

# Optimized solution
def cross(a,b):return a[0]*b[1] - a[1]*b[0]

q = list(range(int(eval(input()))))
for i in q:
    a,b,c,d,e,f,g,h = [int(x) for x in input().split()]
    A = [c-a,d-b]; B = [e-a,f-b]; C = [g-a,h-b];
    D = [g-e,h-f]; E = [a-e,b-f]; F = [c-e,d-f];
    if max(a,c) < min(e,g) or max(e,g) < min(a,c) or max(b,d) < min(f,h) or max(f,h) < min(b,d):
        print("0")
    elif cross(A,B) * cross(A,C) <= 0 and cross(D,E) * cross(D,F) <= 0:
        print("1")
    else:
        print("0")
# Original solution
n = int(eval(input()))
a = [list(map(int,input().split())),list(map(int,input().split()))]
ame = 0
ame_l = []
for i in range(n): #重複する列の選択
  for j in range(n): #各列足してく
    if i > j:
      ame += a[0][j]
    elif i == j:
      ame += a[0][j]+a[1][j]
    else:
      ame += a[1][j]
    if j == n-1:
      ame_l.append(ame)
      ame = 0
print((max(ame_l)))

# Optimized solution
n = int(eval(input()))
a = [list(map(int,input().split())) for _ in range(2)]
ame = []
for i in range(n):
  ame.append(sum(a[0][:i+1])+sum(a[1][i:]))
print((max(ame)))
# Original solution
nums = int(eval(input()))
ary = [0,0]
for i in range(2):
    ary[i] = list(map(int,input().split()))

max = 0

for i in range(nums):
    h = 0
    w = 0
    count = ary[h][w]
    for x in range(nums):
        if i == x :
            h = 1
            count += ary[h][w]
            continue
        w += 1
        count += ary[h][w]
    if count > max :
        max = count
print(max)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))[::-1]
dp = [b[0] for _ in range(n)]
for i in range(1,n):
    dp[i] = dp[i-1]+b[i]
dp = dp[::-1]
c = 0
dp2 = [0 for _ in range(n)]
for i in range(n):
    c += a[i]
    dp2[i] = c +dp[i]
print((max(dp2)))
# Original solution
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
retu = int(eval(input()))
gyo1 = list(map(int,input().split()))
gyo2 = list(map(int,input().split()))
num = 0
kai=0
boss=[]
for i in range(retu):
    for ii in range(i + 1):
        num += gyo1[ii]
    for iii in range(retu-i):
        num += gyo2[iii+i]
    boss.append(num)
    num=0
#print(boss)
oss = sorted(boss)
print((oss[retu-1]))

# Optimized solution
retu = int(eval(input()))
gyo1 = list(map(int,input().split()))
gyo2 = list(map(int,input().split()))
goal=[]
for i in range(retu):
    kai = sum(gyo1[0:i+1]) + sum(gyo2[i:])
    goal.append(kai)
print((max(goal)))
# Original solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(eval(input()))
    l1=list(map(int,input().split()))
    l2=list(map(int,input().split()))
    ans=0
    for i in range(n):
        ans=max(ans,sum(l1[:i+1]+l2[i:]))
    print(ans)
resolve()

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(eval(input()))
    l1=list(map(int,input().split()))
    l2=list(map(int,input().split()))
    ans=0
    for i in range(n):
        cnt=sum(l1[:i+1])+sum(l2[i:])
        ans=max(ans,cnt)
    print(ans)
resolve()
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(eval(input()))
array_1 = list(map(int, input().split()))
array_2 = list(map(int, input().split()))
# 全探索する
# N回移動できる
# どのタイミングで下に移動するかがキーポイント
# 下に移動するタイミングはN通りある
max_candy = 0
for n in range(N):
    # n列目で下に移動したときのキャンディの個数をチェック
    total = sum(array_1[: n + 1] + array_2[n:])
    # 記録更新なら上書き
    if max_candy < total:
        max_candy = total
print(max_candy)


# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(eval(input()))
array_1 = list(map(int, input().split()))
array_2 = list(map(int, input().split()))
# 全探索する
# N回移動できる
# どのタイミングで下に移動するかがキーポイント
# 下に移動するタイミングはN通りある
max_candy = 0
for n in range(N):
    # n列目で下に移動したときのキャンディの個数をチェック
    total = sum(array_1[: n + 1]) + sum(array_2[n:])
    # 記録更新なら上書き
    if max_candy < total:
        max_candy = total
print(max_candy)
# Original solution
## coding: UTF-8
N = int(eval(input()))
s = input().split()
l1 = [int(p) for p in s]
s2 = input().split()
l2 = [int(p) for p in s2]

#print(N)
#print(l1)
#print(l2)
#print(sum(l1[2:]))

def Cumulative_sum(l):
    output_list = []
    for i in range(len(l)):
        output_list.append(sum(l[:i+1]))
    return output_list

#print(Cumulative_sum(l1))
#print(Cumulative_sum(l2))
#print(Cumulative_sum(l2)[len(l2)-1])


def calc_sum(cut_off):
    if(cut_off != 0):
        add = Cumulative_sum(l1)[cut_off] + Cumulative_sum(l2)[len(l2)-1] - Cumulative_sum(l2)[cut_off - 1]
    else:
        add = Cumulative_sum(l1)[cut_off] + Cumulative_sum(l2)[len(l2)-1]
    return add

#print(calc_sum(0))
#print(calc_sum(1))
#print(calc_sum(2))

answer = 0
for i in range(N):
    if(answer <= calc_sum(i)):
        answer = calc_sum(i)
        #print(answer)
print(answer)

'''
answer = 0

mode = 1 #上の段

def countup(mode, index):
    if(mode == 1):
        add = l1[index]
    if(mode == 2):
        add = l2[index]
    return add


answer += countup(mode, 0)
for i in range(1,N):
    #print(sum(l1[i:]))
    #print(sum(l2[i-1:]))
    if( mode == 1 and sum(l1[i:]) < sum(l2[i-1:]) ):
        mode = 2 #下の段に移動
        answer += countup(mode, i-1)
    #print('mode:{}, index:{}'.format(mode, i))
    answer += countup(mode, i)
if(N == 1):
    answer += l2[0]
print(answer)
'''






# Optimized solution
## coding: UTF-8
#累積和
N = int(eval(input()))
U = list(map(int,input().split()))
D = list(map(int,input().split()))

U = U[::-1]
D = D[::-1]

up = 0
down = 0
upper = [0]
downer = []
for i in range(N):
    up += U[i]
    down += D[i]
    upper.append(up)
    downer.append(down)
upper = upper[::-1]
downer = downer[::-1]
#print(upper)
#print(downer)

ans = 0
for i in range(N):
    ret = upper[0] - upper[i+1] + downer[i]
    ans = max(ans, ret)
print(ans)
# Original solution
## coding: UTF-8
#累積和
N = int(eval(input()))
U = list(map(int,input().split()))
D = list(map(int,input().split()))

U = U[::-1]
D = D[::-1]

up = 0
down = 0
upper = [0]
downer = []
for i in range(N):
    up += U[i]
    down += D[i]
    upper.append(up)
    downer.append(down)
upper = upper[::-1]
downer = downer[::-1]
#print(upper)
#print(downer)

ans = 0
for i in range(N):
    ret = upper[0] - upper[i+1] + downer[i]
    ans = max(ans, ret)
print(ans)

# Optimized solution
## coding: UTF-8
#DP
N = int(eval(input()))
U = list(map(int,input().split()))
D = list(map(int,input().split()))

#dp = [[0] * 2] * N #これだとアドレスごとコピーされている
dp = []
for i in range(N):
    dp.append([0] * 2)
dp[0][0] = U[0]
dp[0][1] = U[0] + D[0]
for i in range(1, N):
    dp[i][0] = dp[i-1][0] + U[i]
    dp[i][1] = max(dp[i-1][1], dp[i][0]) + D[i]
    #print(dp)
print((dp[N-1][1]))
# 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):
    sumn=sum(A[:i+1])+sum(B[i:])
    ans=max(sumn,ans)
print(ans)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
maxn=0
for i in range(n):
    maxn=max(maxn,sum(a[:i+1])+sum(b[i:]))
print(maxn)
# Original solution
n = int(eval(input()))
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a1.reverse()
a2.reverse()
ans = 0
for i in range(n):
    c = sum(a1[i:])+sum(a2[:i+1])
    ans = max(ans,c)
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
import itertools
N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(2)]
L = [0 for _ in range(1,N)] + [1]
PL = list(itertools.permutations(L,N))
MAX = 0
for P in PL:
    now = (0,0)
    total = A[0][0]
    for p in P:
        if p == 0:
            now = (now[0],now[1]+1)
        else:
            now = (now[0]+1,now[1])
        total += A[now[0]][now[1]]
    MAX = max(MAX,total)
print(MAX)

# Optimized solution
N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(2)]
MAX = 0
for i in range(N):
    MAX = max(MAX,sum(A[0][:i+1])+sum(A[1][i:]))
print(MAX)
# Original solution
import sys
from collections import deque
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

n=int(input().rstrip())
a=[list(map(int,input().split())) for _ in range(2)]
ans=0
print((max([sum(a[0][:i+1])+sum(a[1][i:]) for i in range(n)])))

# Optimized solution
import sys
input=sys.stdin.readline

n=int(input().rstrip())
a=[list(map(int,input().split())) for _ in range(2)]

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

m.reverse()

ls = [0]*(n+1)
ms = [0]*(n+1)

for i in range(n):
  ls[i+1] = ls[i] + l[i]
  ms[i+1] = ms[i] + m[i]

max_a = 0
for j in range(n):
  max_a = max(max_a, ls[j+1]+ms[n-j])
print(max_a)
  

# Optimized solution
n = int(eval(input()))
L1 = list(map(int, input().split()))
L2 = list(map(int, input().split()))

ans = 0
for i in range(n):
    L1_ = L1[0:i+1]
    L2_ = L2[i:]
    #print(L1_, L2_)
    temp = sum(L1_) + sum(L2_)
    ans = max(ans, temp)
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):
  ans = max(ans, sum(a1[:i+1])+sum(a2[i:]))
print(ans)

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

ans = 0
for i in range(n):
  t = sum(a[0][:i+1]) + sum(a[1][i:])
  if ans < t: ans = t
print(ans)
# Original solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
count = 0
max1 = 0
for i in range(n):
    for j in range(n):
        if j < i:
            count += a1[j]
        elif j==i:
            count += (a1[j] + a2[j])
        else:
            count += a2[j]
    if max1 < count:
        max1 = count
    count = 0
print (max1)

# Optimized solution
n = int(eval(input()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
m = 0
for i in range(n):
    m = max(m, sum(a1[:i+1])+sum(a2[i:]))
print (m)
# 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=0
    tmp+=sum(a1[:i+1])
    tmp+=sum(a2[i:])
    ans=max(tmp,ans)
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):
    top=sum(a1[:i+1])
    bottom=sum(a2[i:])
    tmp=top+bottom
    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):
    ans = 0
    for j in range(i+1):
        ans += A[j]
    for j in range(i,N):
        ans += B[j]
    Ans = max(Ans,ans)
print(Ans)

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

Ans = 0
for x in range(N):
    ans = 0
    for i in range(N):
        if i <= x:
            ans += A1[i]
        if i >= x:
            ans += A2[i]
    Ans = max(Ans,ans)

print(Ans)
# Original solution
N = int(eval(input()))
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

Ans = 0
for x in range(N):
    ans = 0
    for i in range(N):
        if i <= x:
            ans += A1[i]
        if i >= x:
            ans += A2[i]
    Ans = max(Ans,ans)

print(Ans)

# Optimized solution
# atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7

# main
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])+sum(A2[i:]))

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

AA=[A[0]]
BB=[B[0]]

for i in range(1,N):
  AA.append(AA[i-1]+A[i])
  BB.append(BB[i-1]+B[i])
BB=BB[::-1]

CC=[]
for i in range(N):
  CC.append(AA[i]+BB[i])
  
print((max(CC)))

# Optimized solution
import sys
input = sys.stdin.buffer.readline

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

left = [A[0][0]]
for i in range(1, N):
  left.append(left[-1] + A[0][i])

A[1] = A[1][::-1]
right = [A[1][0]]
for i in range(1, N):
  right.append(right[-1] + A[1][i])
right = right[::-1]

answer = 0
for i in range(N):
  answer = max(answer, left[i] + right[i])

print(answer)
# Original solution
def main():
    N = int(eval(input()))
    A = [[int(i) for i in input().split()] for j in range(2)]
    ans = 0
    for i in range(N):
        cur = 0
        for j in range(i, N):
            cur = sum(A[0][:i+1]) + sum(A[1][i:])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = [[int(i) for i in input().split()] for j in range(2)]
    ans = 0
    for i in range(N):
        cur = sum(A[0][:i+1]) + sum(A[1][i:])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
def main():
    N = int(eval(input()))
    A = [[int(i) for i in input().split()] for j in range(2)]
    ans = 0
    for i in range(N):
        cur = sum(A[0][:i+1]) + sum(A[1][i:])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    from itertools import accumulate
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    accA = list(accumulate(A))
    accB = list(accumulate([0] + B))
    ans = 0
    for i in range(N):
        cur = accA[i] + (accB[N] - accB[i])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()