We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j).
You are initially in the top-left square, (1, 1).
You will travel to the bottom-right square, (2, N), by repeatedly moving right or down.
The square (i, j) contains A_{i, j} candies.
You will collect all the candies you visit during the travel.
The top-left and bottom-right squares also contain candies, and you will also collect them.
At most how many candies can you collect when you choose the best way to travel?

-----Constraints-----
 - 1 \leq N \leq 100
 - 1 \leq A_{i, j} \leq 100 (1 \leq i \leq 2, 1 \leq j \leq N)

-----Input-----
Input is given from Standard Input in the following format:
N
A_{1, 1} A_{1, 2} ... A_{1, N}
A_{2, 1} A_{2, 2} ... A_{2, N}

-----Output-----
Print the maximum number of candies that can be collected.

-----Sample Input-----
5
3 2 2 4 1
1 2 2 2 1

-----Sample Output-----
14

The number of collected candies will be maximized when you:
 - move right three times, then move down once, then move right once.
[{"code": "def mapt(fn, *args):\n    return tuple(map(fn, *args))\n\n\ndef Input():\n    return mapt(int, input().split(\" \"))\n\n\ndef main():\n    n = int(input())\n    a_1 = Input()\n    a_2 = Input()\n    ans = 0\n    for i in range(n):\n        ans = max(ans, sum(a_1[:i+1])+sum(a_2[i:n]))\n    print(ans)\n\nmain()", "passed": true, "time": 0.24, "memory": 14092.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(1,N+1):\n  ans = max(sum(A[:i])+sum(B[i-1:]),ans)\nprint(ans)", "passed": true, "time": 0.24, "memory": 14276.0, "status": "done"}, {"code": "N = int(input())\narr = []\nfor _ in range(2):\n  arr.append(list(map(int,input().split())))\n\nans = 0\nfor i in range(0,N):\n  x = sum(arr[0][:i+1]) + sum(arr[1][i:])\n  ans = max(ans,x)\nprint(ans)", "passed": true, "time": 0.16, "memory": 14136.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int,input().split())) for _ in range(2)]\ncnt = 0\nans = 0\nif n != 1:\n    for i in range(1,n):\n        cnt = sum(a[0][0:i]) + sum(a[1][i-1:n])\n        ans = max(ans,cnt)\n        cnt = 0\nelse:\n    ans = a[0][0]+a[1][0]\nprint(ans)", "passed": true, "time": 0.15, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int,input().split())) for _ in range(2)]\ns = 0\nfor i in range(n):\n    s += a[0][i]\n    a[0][i] = s\na[1][0] += a[0][0]\nfor i in range(1, n):\n    a[1][i] += max(a[0][i], a[1][i - 1])\nprint(a[1][-1])", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "N = int(input())\n\nA = [[] for _ in range(2)]\nfor i in range(2):\n    A[i] = list(map(int,input().split()))\n\nAmeMax = 0\nfor n in range(1, N+1):\n    preAme = sum(A[0][:n]) + sum(A[1][n-1:])\n    if AmeMax < preAme:\n        AmeMax = preAme\n\nprint(AmeMax)\n\n", "passed": true, "time": 0.21, "memory": 14264.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int,input().split()))\nA2 = list(map(int,input().split()))\nC = []\n\nS = sum(A2) + A1[0]\n\nfor i in range(1,N):\n  C.append(S)\n  S += A1[i]-A2[i-1]\n  \nif N != 1:\n  print(max(C))\nelse:\n  print(A1[0]+A2[0])", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "N = int(input())\na1 = list(map(int,input().split()))\na2 = list(map(int,input().split()))\n\nmaxim = 0\nfor i in range(N):\n    count = 0\n    count += sum(a1[:i+1]) + sum(a2[i:])\n    if count > maxim:\n        maxim = count\nprint(maxim)", "passed": true, "time": 0.16, "memory": 14260.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    a_lst1 = list(map(int, input().split()))\n    a_lst2 = list(map(int, input().split()))\n    candies_lst = []\n\n    tmp = 1\n    while tmp <= n:\n        a1_tmp = a_lst1[:tmp]\n        a2_tmp = a_lst2[tmp-1:]\n        a1 = sum(a1_tmp)\n        a2 = sum(a2_tmp)\n\n        tmp += 1\n        candies = a1 + a2\n        candies_lst.append(candies)\n\n    maximum = max(candies_lst)\n    print(maximum)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "n = int(input())\naa = [\n    list(map(int, input().split()))\n    for _ in range(2)\n]\n\nif n == 1:\n    print(aa[0][0] + aa[1][0])\n    return\n\nfor i in range(1, n):\n    aa[1][-i - 1] += aa[1][-i]\nfor i in range(1, n):\n    aa[0][-i - 1] += max(aa[1][-i - 1], aa[0][-i])\nprint(aa[0][0])", "passed": true, "time": 0.29, "memory": 14280.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\ntmp = []\ncnd = 0\nfor i in range(n):\n    cnd = sum(a[:i+1]) + sum(b[i:])\n    tmp.append(cnd)\n    cnd = 0\nprint(max(tmp))", "passed": true, "time": 0.17, "memory": 14120.0, "status": "done"}, {"code": "n = int(input())\nl = [list(map(int, input().split())) for _ in range(2)]\n\nr1 = [sum(l[0][:i+1])for i in range(n)]\nr2 = [sum(l[1][i:])for i in range(n)]\n\nmax_cnt = 0\nfor i in range(n):\n    cnt = r1[i] + r2[i]\n    max_cnt = max(max_cnt, cnt)\nprint(max_cnt)", "passed": true, "time": 0.22, "memory": 14168.0, "status": "done"}, {"code": "N = int(input())\n\nA = [list(map(int,input().split())) for i in range(2)]\nB = [[0 for i in range(N)] for j in range(2)]\n\nB[0][0] = A[0][0]\nfor i in range(2):\n    for j in range(N):\n        for x, y in [[0, -1], [-1, 0]]:\n            id = i+x\n            jd = j+y\n            if id < 0 or id >= 2 or jd < 0 or jd >= N: continue\n            c = B[id][jd]+A[i][j]\n            if c > B[i][j]:\n                B[i][j] = c\n        \n\n\nprint(B[1][N-1])", "passed": true, "time": 0.22, "memory": 14248.0, "status": "done"}, {"code": "n = int(input())\nL = [list(map(int,input().split())), list(map(int,input().split()))]\nans = 0\n\nfor i in range(n):\n  cnt = 0\n  for j in range(n):\n    if j < i: \n      cnt += L[0][j]\n    elif j == i:\n      cnt += L[0][j] + L[1][j]\n    else:\n      cnt += L[1][j]\n  ans = max(ans,cnt)\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14208.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 21 21:50:38 2020\n\n@author: liang\n\"\"\"\n\nN = int(input())\nA = [int(x) for x in input().split()]\nB = [int(x) for x in input().split()]\n\ntmp = sum(A) + B[N-1]\nans = tmp\nfor i in reversed(range(1,N)):\n    tmp -= A[i]\n    tmp += B[i-1]\n    if ans < tmp:\n        ans = tmp\nprint(ans)", "passed": true, "time": 0.24, "memory": 14256.0, "status": "done"}, {"code": "n=int(input())\na = list(map(int, input().split()))\nb= list(map(int, input().split()))\nans=0\nfor i in range(n):\n  if ans<(sum(a[:i+1])+sum(b[i:])):\n    ans=(sum(a[:i+1])+sum(b[i:]))\nprint(ans)", "passed": true, "time": 0.22, "memory": 14224.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nmax=0\nfor i in range(n):\n  tmp=sum(a[:i+1])\n  tmp+=sum(b[i:])\n  if max<tmp:\n    max=tmp\n\nprint(max)", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "import itertools\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nmaxi = 0\n\nfor i in range(N):\n    if sum(A[0:i+1]) + sum(B[i:N]) > maxi:\n        maxi = sum(A[0:i+1]) + sum(B[i:N])\n\nprint(maxi)\n", "passed": true, "time": 0.22, "memory": 14188.0, "status": "done"}, {"code": "N=int(input())\na=list(map(int,input().strip().split()))\nb=list(map(int,input().strip().split()))\n\n#\u7d2f\u7a4d\u548c\nA=[]\nB=[]\nsuma=0\nsumb=0\nfor n in range(N):\n    suma+=a[n]\n    A.append(suma)\nfor n in reversed(range(N)):\n    sumb+=b[n]\n    B.append(sumb)\n\nMAX=0\nfor n in range(N):\n    MAX=max(MAX,A[n]+B[N-n-1])\nprint(MAX)", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "n=int(input())\n\na=[[int(i) for i in input().split()] for j in range(2)]\n\nsentou=[]\nusiro=[]\n\nfor i in range(n):\n    if i==0:\n        sentou.append(a[0][0])\n        usiro.append(a[1][-1])\n    else:\n        sentou.append(a[0][i]+sentou[-1])\n        usiro.append(a[1][-i-1]+usiro[-1])\n\nusiro=usiro[::-1]\nans=[]\nfor i in range(n):\n    ans.append(sentou[i]+usiro[i])\nprint(max(ans))", "passed": true, "time": 0.14, "memory": 14364.0, "status": "done"}, {"code": "n = int(input())\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\n\nres = 0\ntmp1 = 0\nfor i in range(n):\n    tmp1 += a1[i]\n    tmp2 = 0\n    for j in range(i, n):\n        tmp2 += a2[j]\n    res = max(res, tmp1+tmp2)\n\nprint(res)\n", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "n = int(input())\nal = list(list(map(int, input().split())) for _ in range(2))\n\nans = 0\nfor i in range(n):\n    # print(al[0][:i+1], al[1][i:])\n    ans = max(ans, sum(al[0][:i+1]) + sum(al[1][i:]))\n\nprint(ans)", "passed": true, "time": 0.16, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\nl = list(map(int, input().split()))\nm = list(map(int, input().split()))\na = 0\nb = 0\n\nfor j in range(n):\n  b = sum(l[0:j+1]) + sum(m[j:n+1])\n  if a < b:\n    a = b\n  else:\n    pass\n  \nprint(a)\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "N = int(input())\nList = []\nfor i in range (2):\n  List.append(list(map(int, input().split())))\nsumList1 = [0]*N\nsumList2 = [0]*N\nfor i in range(N):\n  if i == 0:\n    sumList1[i] = List[0][i]\n    sumList2[N-1-i] = List[1][N-1-i]\n  else:\n    sumList1[i] = List[0][i]+sumList1[i-1]\n    sumList2[N-1-i] = List[1][N-1-i]+sumList2[N-i]\nres = 0\nfor i in range(N):\n  res = max(sumList1[i]+sumList2[i],res)\nprint(res)", "passed": true, "time": 0.15, "memory": 14272.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, A: \"List[List[int]]\"):\n    from itertools import accumulate\n    B = [list(accumulate([0]+a)) for a in A]\n    return max(B[0][i+1] + B[1][N] - B[1][i] for i in range(N))\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools\ndef main():\n    def iterate_tokens():\n        for line in sys.stdin:\n            for word in line.split():\n                yield word\n    tokens = iterate_tokens()\n    N = int(next(tokens))  # type: int\n    A = [[int(next(tokens)) for _ in range(N)] for _ in range(2)]  # type: \"List[List[int]]\"\n    print((solve(N, A)))\n\ndef test():\n    import doctest\n    doctest.testmod()\n\ndef __starting_point():\n    #test()\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n    ans = max(ans, sum(A[:i+1]) + sum(B[i:]))\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\nN = int(input())\nA = [list(map(int, input().split())) for _ in range(2)]\n\nans = 0\nfor k in range(N):\n    res = 0\n    for x in range(N):\n        if x < k:\n            res += A[0][x]\n        elif x==k:\n            res += A[0][x]+A[1][x]\n        else:\n            res += A[1][x]\n\n    ans = max(ans,res)\n\nprint(ans)", "passed": true, "time": 0.27, "memory": 14120.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split())) ##\u4e0a\u6bb5\nB = list(map(int,input().split())) ##\u4e0b\u6bb5\n\ndp = [[] for i in range(N)]\ndp[0] = A[0] + B[0]\nUpSum = A[0]\nfor i in range(1,N):\n    UpSum += A[i] \n    dp[i] = max(dp[i-1],UpSum) + B[i]\nprint(dp[-1])", "passed": true, "time": 0.39, "memory": 14284.0, "status": "done"}, {"code": "\n\nN = int(input())\n\nupper = list(map(int,input().split()))\ndown = list(map(int,input().split()))\n\nscores = []\nfor i in range(N):\n    score = 0\n    flag = 0\n    for j in range(N):\n        if i == j and flag == 0:\n            score += upper[j]\n            score += down[j]\n            flag = 1\n        elif flag == 0:\n            score += upper[j]\n        elif flag == 1:\n            score += down[j]\n    scores.append(score)\n\nprint(max(scores))", "passed": true, "time": 0.22, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\n\nlis = []\nfor _ in range(2):\n    lis.append(list(map(lambda x: int(x), input().split(\" \"))))\nmax = 0\nfor i in range(n):\n    su = sum(lis[0][:i + 1])\n    su += sum(lis[1][i:])\n    if su >= max:\n        max = su\n\nprint(max)", "passed": true, "time": 0.22, "memory": 14188.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int,input().split()))\nA2 = list(map(int,input().split()))\n\ns = []\n\nfor i in range(N):\n  a = sum(A1[0:i+1])+sum(A2[i:])\n  s.append(a)\n\nprint((max(s)))\n", "passed": true, "time": 0.26, "memory": 14220.0, "status": "done"}, {"code": "N = int(input())\nA1= list(map(int,input().split()))\nA2= list(map(int,input().split()))\nsum2 = sum(A2)\nans = A1[0]+sum2\nvalue = A1[0]+sum2\nfor i in range(1,N):\n    value = value + A1[i] - A2[i-1]\n    ans = max(ans,value)\nprint(ans)", "passed": true, "time": 0.41, "memory": 14128.0, "status": "done"}, {"code": "N = int(input())\nS1,S2 = [list(map(int,input().split())) for i in range(2)]\nS = 0\nfor i in range(N):\n  S = max(S,sum(S1[:i+1])+sum(S2[i:]))\nprint(S)", "passed": true, "time": 0.15, "memory": 14200.0, "status": "done"}, {"code": "n = int(input())\narr = [list(map(int,input().split())) for _ in range(2)]\nans = 0\nfor i in range(n):\n    ans = max(ans, sum(arr[0][:i+1] + arr[1][i:]))\nelse:\n    print(ans)", "passed": true, "time": 0.25, "memory": 14108.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=0\nfor i in range(n):\n    c=max(sum(a[:i+1])+sum(b[i:]),c)\nprint(c)", "passed": true, "time": 0.42, "memory": 14056.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int,input().split()))\nA2 = list(map(int,input().split()))\nans = 0\nfor i in range(N):\n    cnt = sum(A1[:i+1]) + sum(A2[i:])\n    ans = max(ans,cnt)\nprint(ans)", "passed": true, "time": 0.2, "memory": 14120.0, "status": "done"}, {"code": "n=int(input())\na=[[],[]]\na[0]=list(map(int,input().split()))\na[1]=list(map(int,input().split()))\nans=0\nfor i in range(n):\n    x,sum=0,0\n    for j in range(n+1):\n        if i==j-1:x=1\n        sum+=a[x][j-x]\n    ans=max(sum,ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nB=list(map(int,input().split()))\n\nnax=0\n\nfor i in range(N):\n    nax=max(nax,sum(A[:i+1])+sum(B[i:]))\nprint(nax)", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int,input().split())),list(map(int,input().split()))]\name = 0\name_l = []\nfor i in range(n): #\u91cd\u8907\u3059\u308b\u5217\u306e\u9078\u629e\n  for j in range(n): #\u5404\u5217\u8db3\u3057\u3066\u304f\n    if i > j:\n      ame += a[0][j]\n    elif i == j:\n      ame += a[0][j]+a[1][j]\n    else:\n      ame += a[1][j]\n    if j == n-1:\n      ame_l.append(ame)\n      ame = 0\nprint(max(ame_l))", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\nl = [list(map(int, input().split())) for _ in range(2)]\n\nr1 = []\ntmp1 = 0\nfor i in range(n):\n    rui1 = l[0][i] + tmp1\n    r1.append(rui1)\n    tmp1 = rui1\n\nr2 = [0] * n\ntmp2 = 0\nfor i in reversed(range(n)):\n    rui2 = l[1][i] + tmp2\n    r2[i] = rui2\n    tmp2 = rui2\n\nmax_cnt = 0\nfor i in range(n):\n    cnt = r1[i] + r2[i]\n    max_cnt = max(max_cnt, cnt)\nprint(max_cnt)", "passed": true, "time": 0.2, "memory": 14284.0, "status": "done"}, {"code": "N=int(input())\nA=[list(map(int,input().split())) for _ in range(2)]\nsum1=[0]\nsum2=[0]\nfor i in range(N):\n    sum1.append(sum1[-1]+A[0][i])\n    sum2.append(sum2[-1]+A[1][i])\n\nprint((max(sum1[i]+sum2[N]-sum2[i-1] for i in range(1,N+1))))\n", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\ndp=[[0 for i in range(n)] for j in range(2)]\ndp[0][0]=a[0]\nfor i in range(1,n):\n    dp[0][i]=a[i]+dp[0][i-1]\ndp[1][0]=dp[0][0]+b[0]\nfor i in range(1,n):\n    dp[1][i]=max(dp[0][i],dp[1][i-1])+b[i]\nprint((dp[1][n-1]))\n\n", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split())) \nB = list(map(int,input().split()))[::-1]\n#print(A)\n#print(B)\n\n\nl = []\n\nfor i in range(N):\n    l.append(sum(A[:N-i])+sum(B[:i+1]))\n    \n#print(l)\nprint((max(l)))\n\n\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "n=int(input())\na=[list(map(int,input().split())) for i in range(2)]\nans=0\nif n==1:\n  print(sum(a[0])+sum(a[1]))\n  return\nfor i in range(n):\n  ans=max(ans,sum(a[0][0:i])+sum(a[1][i-1:n]))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int,input().split())) for _ in range(2)]\nprint(max(sum(a[0][:i+1] + a[1][i:]) for i in range(n)))", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "N=int(input())\nA=[]\nfor _ in range(2):\n    A.append(list(map(int,input().split())))\nans=0\nfor i in range(N):\n    tmp=0\n    tmp+=sum(A[0][:i+1])\n    tmp+=sum(A[1][i:])\n    if tmp>ans:\n        ans=tmp\nprint(ans)", "passed": true, "time": 0.15, "memory": 14208.0, "status": "done"}, {"code": "def mapt(fn, *args):\n    return tuple(map(fn, *args))\n\n\ndef Input():\n    return mapt(int, input().split(\" \"))\n\n\ndef main():\n    n = int(input())\n    a_1 = Input()\n    a_2 = Input()\n\n    a_1_sum = [0] * n\n    a_2_sum = [0] * n\n    a_1_sum[0] = a_1[0]\n\n    for i in range(1, n):\n        a_1_sum[i] = a_1_sum[i-1] + a_1[i]\n    for i in range(n):\n        a_2_sum[i] = sum(a_2) - sum(a_2[:i])\n\n    ans = 0\n    for a1, a2 in zip(a_1_sum, a_2_sum):\n        ans = max(ans, a1+a2)\n    print(ans)\n\n\nmain()", "passed": true, "time": 0.24, "memory": 14272.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\n\nC = [0] * N \nC[0] = A[0] + sum(B)\nfor i in range(1,N):\n    C[i] = C[i-1]+A[i]-B[i-1]\nprint((max(C)))\n", "passed": true, "time": 0.24, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\nup = list(map(int,input().split()))\ndw = list(map(int,input().split()))\nans = up[0]+sum(dw)\ntmp = up[0]+sum(dw)\nfor i in range(1,n):\n  tmp = tmp+up[i]-dw[i-1]\n  ans = max(tmp,ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int, input().split()))\nA2 = list(map(int, input().split()))\n\na1 = [0]\na2 = [0]\n\nfor i in range(N):\n  if i == 0:\n    a1.append(A1[i])\n    a2.append(A2[i])\n  else:\n    a1.append(a1[-1] + A1[i])\n    a2.append(a2[-1] + A2[i])\n    \nans = 0\n\nfor i in range(N):\n  if a1[i+1] + a2[-1] - a2[i] > ans:\n    ans = a1[i+1] + a2[-1] - a2[i]\n    \nprint(ans)", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "n = int(input())\na1 = list(map(int,input().split()))\na2 = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n  ans = max(ans,sum(a1[0:i+1])+sum(a2[i:n]))\nprint(ans)\n\n\n\n", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n=int(input())\na = [list(map(int,input().split())) for _ in range(2)]\n\namemax=0\nfor i in range(n):\n    ame=sum(a[0][:i+1])+sum(a[1][i:])\n    amemax = max(ame,amemax)\n    \nprint(amemax)", "passed": true, "time": 0.24, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\na = [int(x) for x in input().split()]\nb = [int(x) for x in input().split()]\nres = 0\nfor i in range(n):\n  c = 0\n  for j in range(n):\n    if j < i:\n      c += a[j]\n    elif j == i:\n      c += a[j]\n      c += b[j]\n    else:\n      c += b[j]\n  res = max(res,c)\nprint(res)", "passed": true, "time": 0.15, "memory": 14216.0, "status": "done"}, {"code": "N = int(input())\nA1 = input().split(' ')\nA2 = input().split(' ')\nA1 = [int(A1[i]) for i in range(N)]\nA2 = [int(A2[i]) for i in range(N)]\nSaidai = 0\nfor i in range(N):\n  Atai = 0\n  for j in range(i+1):\n    Atai += A1[j]\n  for h in range(i, N):\n    Atai += A2[h]\n  if Atai > Saidai:\n    Saidai = Atai\nprint(Saidai)", "passed": true, "time": 0.25, "memory": 14036.0, "status": "done"}, {"code": "n = int(input())\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\n\nfor i in range(1, n):\n    a1[i] += a1[i - 1]\n\nfor i in range(n - 2, -1, -1):\n    a2[i] += a2[i + 1]\n\nres = 0\nfor i in range(n):\n    tmp = a1[i] + a2[i]\n    res = max(tmp, res)\n\nprint(res)\n", "passed": true, "time": 0.15, "memory": 14104.0, "status": "done"}, {"code": "n = int(input())\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\nans = sum(a1)+a2[-1]\nmemo = ans\na1.reverse()\na2.reverse()\nfor i in range(n-1):\n    memo -=a1[i]-a2[i+1]\n    if memo > ans:\n        ans = memo\nprint(ans)\n", "passed": true, "time": 0.16, "memory": 14284.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int, input().split()))\nans = 0\nfor i in range(n):\n        ans = max(ans,sum(a[:i+1])+sum(b[i:n]))\nprint(ans)", "passed": true, "time": 1.01, "memory": 14280.0, "status": "done"}, {"code": "n = int(input())\na_l1 = list(map(int, input().split()))\na_l2 = list(map(int, input().split()))\nc = 0\nm_a_l1 = []\nfor i in a_l1:\n    c += i\n    m_a_l1.append(c)\nc = 0\nm_a_l2 = [0] * n\nfor i,j in enumerate(reversed(a_l2)):\n    c += j\n    m_a_l2[-1-i] = c\n\nans = 0\nfor i,j in zip(m_a_l1, m_a_l2):\n    ans = max(i+j, ans)\nprint(ans)", "passed": true, "time": 0.21, "memory": 14256.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\nC=[]\nfor i in range(N):\n    C.append(sum(A[0:i+1])+sum(B[i:]))\nprint(max(C))", "passed": true, "time": 0.21, "memory": 14256.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\n\nans = 0\nx = 0\nC = []\nD = []\nif N == 1:\n    print((A[0] + B[0]))\n    return\nfor i in range(N):\n    C = A[0:i]\n    D = B[i - 1:N]\n    x = sum(C) + sum(D)\n    ans = max(ans, x)\n\nprint(ans)\n", "passed": true, "time": 0.17, "memory": 14072.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int, input().split()))\nA2 = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n    t = 0\n    for j in range(0, min(N, i + 1)):\n        t += A1[j]\n    for k in range(i, N):\n        t += A2[k]\n    ans = max(t, ans)\nprint(ans)\n", "passed": true, "time": 0.16, "memory": 14156.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int,input().split())) for _ in range(2)]\name = []\nfor i in range(n):\n  ame.append(sum(a[0][:i+1])+sum(a[1][i:]))\nprint(max(ame))", "passed": true, "time": 0.21, "memory": 14284.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n  ans = max(ans, sum(A[:i+1])+sum(B[i:]))\nprint(ans)", "passed": true, "time": 0.17, "memory": 14060.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int, input().split())) for _ in range(2)]\n\nans = 0\nfor i in range(n):\n  t = sum(a[0][:i+1]) + sum(a[1][i:])\n  if ans < t: ans = t\nprint(ans)", "passed": true, "time": 0.16, "memory": 14340.0, "status": "done"}, {"code": "N = int(input())\nA_top = list(map(int,input().split()))\nA_down = list(map(int,input().split()))\ncnt_max = 0\n\nfor i in range(N):\n  count = sum(A_top[:i+1]) + sum(A_down[i:])\n  if count > cnt_max:\n    cnt_max = count\n    \nprint(cnt_max)\n", "passed": true, "time": 0.18, "memory": 14260.0, "status": "done"}, {"code": "#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n    maps=[]\n    n = int(input())\n    maps=[list(map(int,input().split())) for _ in range(2)]\n    dp=[]\n    for i in range(n):\n        total=sum(maps[0][:i+1])+sum(maps[1][i:])\n        dp.append(total)\n    print(max(dp))\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "n=int(input())\nA1=list(map(int,input().split()))\nA2=list(map(int,input().split()))\nans=0\nfor i in range(n):\n  ans=max(ans,sum(A1[:i+1])+sum(A2[i:]))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "\nN = int(input())\nAU = list(map(int, input().split()))\nAD = list(map(int, input().split()))\n\nAUS = [AU[0]]\nADS = [AD[-1]]\n\nfor i in range(1, N):\n  AUS.append(AUS[-1] + AU[i])\n  ADS.append(ADS[-1] + AD[-1-i])\n\nADS.reverse()\n\nans = 0\nfor i in range(N):\n  temp = AUS[i]+ADS[i]\n  ans = max(ans, temp)\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "N = int(input())\nA = list([0]*N for _ in range(2))\nfor i in range(2):\n    A[i] = list(map(int, input().split()))\n\nresult = []\n\nfor i in range(N):\n    tmp = 0\n    tmp += sum(A[0][0:i+1])\n    tmp += sum(A[1][i:N])\n    result.append(tmp)\n\nprint(max(result))", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int,input().split())) for _ in range(2)]\nprint(max((sum(a[0][:i+1] + a[1][i:])) for i in range(n)))", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nmax=0\nfor i in range(n):\n    tmp=sum(a[:i+1])\n    tmp+=sum(b[i:])\n    if max<tmp:\n        max=tmp\nprint(max)", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\n\name_A = [0] * N\name_B = [0] * N\n\nfor i in range(N):\n  if i == 0:\n    ame_A[i] += A[i]\n    continue\n  ame_A[i] += ame_A[i-1] + A[i]\n\nfor i in range(N-1,-1,-1):\n  if i == N - 1:\n    ame_B[i] += B[i]\n    continue\n  ame_B[i] += ame_B[i+1] + B[i]\n  \nans = 0\nfor j in range(N):\n  cnt = ame_A[j] + ame_B[j]\n  ans = max(ans, cnt)\n  \nprint(ans)", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int,input().split()))\nA2 = list(map(int,input().split()))\n\ns = []\n\nfor i in range(N):\n  a = sum(A1[0:i+1])+sum(A2[i:])\n  s.append(a)\n\nprint(max(s))", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nn = int(input())\na = [list(map(int, input().split())) for i in range(2)]\n\ndp = [[0]*(n+1) for _ in range(3)]\n\nfor i in range(1, 3):\n    for j in range(1, n+1):\n        now = a[i-1][j-1]\n        dp[i][j] = max(dp[i-1][j], dp[i][j-1])+now\n\n# print(dp)\nprint((dp[-1][-1]))\n", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "n = int(input())\na = [list(map(int, input().split())) for _ in range(2)]\n\nm = 0\n\nfor i in range(n):\n    l = sum(a[0][:i+1]) + sum(a[1][i:])\n    m = max(m, l)\n\nprint(m)\n", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "N = int(input())\nA1 = list(map(int, input().split()))\nA2 = list(map(int, input().split()))\nans = 0\n\nfor i in range(N):\n    x = sum(A1[:i+1])+sum(A2[i:])\n    if x > ans:\n        ans = x\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n    maps=[]\n    n = int(input())\n    maps=[list(map(int,input().split())) for _ in range(2)]\n    dp=[]\n    for i in range(n):\n        total=sum(maps[0][:i+1])+sum(maps[1][i:])\n        dp.append(total)\n    print(max(dp))\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14068.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nlist1 = []\name = A[0]\nfor i in range(N-1):\n  list1.append(sum(A[:i+1])+sum(B[i:]))\n  \nif list1 == []:\n  print(A[0]+B[0])\nelse:\n  print(max(list1))", "passed": true, "time": 0.15, "memory": 14356.0, "status": "done"}, {"code": "N = int(input())\nA = [list(map(int, input().split())) for _ in range(2)]\n\n# \u9ad8\u3005N\u901a\u308a\n# A[0][0] + (A[1][0] + ... + A[1][N-1])\n# (A[0][0] + A[0][1]) + (A[1][1] + ... + A[1][N-1])\n# (A[0][0] + A[0][1] + A[0][2]) + (A[1][2] + ... + A[1][N-1])\n# (A[0][0] + ...+ A[0][N-1]) + A[1][N-1]\n\n# N=100 => O(N^2)\u3067\u9593\u306b\u5408\u3046\nans = 0\nfor i in range(N):\n  ans = max(ans, sum(A[0][:i+1]) + sum(A[1][i:]))\n  \nprint(ans)", "passed": true, "time": 0.22, "memory": 14256.0, "status": "done"}, {"code": "def main():\n    N = int(input())\n    A1 = list(map(int, input().split()))\n    A2 = list(map(int, input().split()))\n    ans = 0; cnt = 0\n    for i in range(N):\n        cnt += sum(A1[:i]) + A1[i]\n        cnt += sum(A2[i:])\n        ans = max(ans, cnt)\n        cnt = 0\n    print(ans)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "N=int(input())\n\nA1=list(map(int,input().split()))\nA2=list(map(int,input().split()))\nans=0\nfor i in range(N):\n    temp=sum(A1[:i+1])+sum(A2[i:])\n    if temp>ans:\n        ans=temp\n\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14104.0, "status": "done"}, {"code": "import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\ndef solve():\n    n = ini()\n    a1 = inl()\n    a2 = inl()\n    b1, b2 = a1[0], a1[0] + a2[0]\n    for i in range(1, n):\n        b2 = max(b2 + a2[i], b1 + a1[i] + a2[i])\n        b1 = b1 + a1[i]\n    return b2\n\n\nprint(solve())\n", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "n = int(input())\na1 = [ int(x) for x in input().split() ]\na2 = [ int(x) for x in input().split() ]\n\ncandy_max = 0\n\nfor i in range(n+1):\n    candies = sum(a1[0:i+1]) + sum(a2[i:n])\n    if candy_max < candies:\n        candy_max = candies\n\nprint(candy_max)\n", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nans=0\nfor i in range(n):\n    z=0\n    for j in range(i+1):\n        z+=a[j]\n    for j in range(i,n):\n        z+=b[j]\n    ans=max(ans,z)\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nacount=0\nbcount=0\nans=0\n\nfor i in range(n):\n  bcount=0\n  acount+=a[i]\n  for j in range(i,n):\n    bcount+=b[j]\n    if ans<acount+bcount:\n      ans=acount+bcount\nprint(ans)", "passed": true, "time": 0.15, "memory": 14152.0, "status": "done"}, {"code": "n  = int(input())\n\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nans = []\nfor i in range(n):\n  ans.append(sum(a[0:i+1]) + sum(b[i:n]))\n\n\nprint(max(ans))", "passed": true, "time": 0.23, "memory": 14260.0, "status": "done"}, {"code": "import sys\n\ninput = sys.stdin.readline\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nans = 0\nfor i in range(N):\n    tmp = sum(A[:i+1]) + sum(B[i:])\n    ans = max(ans, tmp)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "# coding: utf-8\n\n\ndef main():\n    N = int(input())\n    A = [list(map(int, input().split())) for _ in range(2)]\n\n    for i in range(1, N):\n        A[0][i] += A[0][i - 1]\n        A[1][N - i - 1] += A[1][N - i]\n\n    ans = max([A[0][i] + A[1][i] for i in range(N)])\n\n    print(ans)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "n = int(input())\ndp = [[0 for i in range(n)] for i in range(2)]\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\n\ndp[0][0] = a1[0]\nfor i in range(1, n):\n    dp[0][i] = dp[0][i - 1] + a1[i]\ndp[1][0] = dp[0][0] + a2[0]\n\nfor i in range(1, n):\n    dp[1][i] = max(dp[0][i] + a2[i], dp[1][i - 1] + a2[i])\n\nprint((dp[1][-1]))\n", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "N = int(input())\n\nr1 = [int(s) for s in input().split()]\nr2 = [int(s) for s in input().split()]\n\nsum_max = 0\nfor e in range(N):\n  right = r1[:e+1]\n  left = r2[e:]\n  if sum_max < sum(right) + sum(left):\n    sum_max = sum(right) + sum(left)\n\nprint(sum_max)\n", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "N = int(input())\nA = [[],[]]\nA[0] = list(map(int, input().split()))\nA[1] = list(map(int, input().split()))\nresult = 0\nfor i in range(N+1):\n    result = max(sum(A[0][:i]) + sum(A[1][i-1:]), result)\nprint(result)", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n = int(input())\nA1 = list(map(int, input().split()))\nA2 = list(map(int, input().split()))\nmax_p = -1\n\nfor i in range(n):\n    point = sum(A1[:i+1]) + sum(A2[i:])\n    max_p = max(max_p, point)\nprint(max_p)", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "n=int(input())\nx=list(map(int,input().split()))\ny=list(map(int,input().split()))\nans=0\nfor i in range(n):\n    ans=max(ans,sum(x[:i+1])+sum(y[i:]))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14056.0, "status": "done"}, {"code": "N=int(input())\nA=[0,0]\nA[0]=list(map(int,input().split()))\nA[1]=list(map(int,input().split()))\ncount=[0]*N\nfor i in range(N) :\n  count[i]+=sum(A[0][:i+1])+sum(A[1][i:])\nprint(max(count))", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}]