You are given a rectangular table 3 × *n*. Each cell contains an integer. You can move from one cell to another if they share a side.

Find such path from the upper left cell to the bottom right cell of the table that doesn't visit any of the cells twice, and the sum of numbers written in the cells of this path is maximum possible.
The first line contains an integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>)  — the number of columns in the table.

Next three lines contain *n* integers each  — the description of the table. The *j*-th number in the *i*-th line corresponds to the cell *a*<sub class="lower-index">*ij*</sub> ( - 10<sup class="upper-index">9</sup> ≤ *a*<sub class="lower-index">*ij*</sub> ≤ 10<sup class="upper-index">9</sup>) of the table.
The path for the first example:

The path for the second example:
3
1 1 1
1 -1 1
1 1 1
7
5
10 10 10 -1 -1
-1 10 10 10 10
-1 10 10 10 10
110
15
-87 -91 31 63 91 35 -14 51 20 20 -20 -94 -59 77 76
11 81 22 -29 91 -26 -10 -12 46 10 100 88 14 64 41
26 -31 99 -39 -30 30 28 74 -7 21 2 32 -60 -74 46
1152
20
16 82 25 21 -60 9 29 -55 70 54 -50 10 -19 40 46 41 31 -66 1 85
-15 75 -94 -7 -50 -97 -55 -24 44 -69 -73 15 -9 98 92 -92 72 -32 -46 59
74 99 -6 97 -59 41 -22 -8 -27 75 3 -56 -38 -56 -43 16 -43 -92 55 -63
946
5
150684603 -262756669 -629261226 393751321 700168705
853551233 -595914191 -266257139 165068700 494943072
328547487 63141018 -951406530 -212389249 -69164259
2218520550
10
687024557 -928074266 -409520915 770775361 240764400 108297300 -280070452 588179696 -920283246 736937716
422602209 -940948979 -483879926 -525886137 -79749893 -958247281 844561102 553768085 269384580 -975129348
-485518332 -130037110 493465239 494308146 958976404 706037260 154106757 -250914836 -915814064 -45677796
4721200012
3
-1 -1 -1
-1 -1 -1
-1 -1 -1
-5
1
1
1
1
3
1
1000000000
1000000000
1000000000
3000000000
3
1 1 1
-1 1 1
-1 1 1
7
2
-36 45
28 -1
2 -21
17
4
-2 -1 2 2
-2 0 0 1
1 -2 2 -1
3
1
-1
0
0
-1
import sys
input = sys.stdin.readline

n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
inf = pow(10, 15)
for _ in range(2):
    a1.append(-inf)
    a2.append(-inf)
    a3.append(0)
dp1 = [-inf] * (n + 2)
dp2 = [-inf] * (n + 2)
dp3 = [-inf] * (n + 2)
dp1[0] = a1[0]
s = a1[0] + a2[0] + a3[0]
for i in range(n):
    s += a1[i + 1] + a2[i + 1] + a3[i + 1]
    dp1[i + 1] = max(dp1[i + 1], dp1[i] + a1[i + 1])
    dp1[i + 1] = max(dp1[i + 1], dp2[i] + a1[i] + a1[i + 1])
    dp1[i + 1] = max(dp1[i + 1], dp3[i] + a2[i] + a1[i] + a1[i + 1])
    dp2[i + 1] = max(dp2[i + 1], dp1[i] + a2[i] + a2[i + 1])
    dp2[i + 1] = max(dp2[i + 1], dp2[i] + a2[i + 1])
    dp2[i + 1] = max(dp2[i + 1], dp3[i] + a2[i] + a2[i + 1])
    dp3[i + 1] = max(dp3[i + 1], dp1[i] + a2[i] + a3[i] + a3[i + 1])
    dp3[i + 1] = max(dp3[i + 1], dp2[i] + a3[i] + a3[i + 1])
    dp3[i + 1] = max(dp3[i + 1], dp3[i] + a3[i + 1])
    dp1[i + 2] = max(dp1[i + 2], dp3[i] + s - a3[i] + a1[i + 2])
    dp3[i + 2] = max(dp3[i + 2], dp1[i] + s - a1[i] + a3[i + 2])
    s -= a1[i] + a2[i] + a3[i]
ans = dp3[n]
print(ans)