Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

D. Maximum path

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou 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.

Input

The first line contains an integer *n* (1 ≤ *n* ≤ 10^{5}) — 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*_{ij} ( - 10^{9} ≤ *a*_{ij} ≤ 10^{9}) of the table.

Output

Output the maximum sum of numbers on a path from the upper left cell to the bottom right cell of the table, that doesn't visit any of the cells twice.

Examples

Input

3

1 1 1

1 -1 1

1 1 1

Output

7

Input

5

10 10 10 -1 -1

-1 10 10 10 10

-1 10 10 10 10

Output

110

Note

The path for the first example:

The path for the second example:

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/16/2018 05:43:48 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|