6
12 8 12 17 20 5
17 4 8 8 8 4
 6
4 1 12 9 3 11
12 20 19 12 19 11
 1
1
1
 2
1 2
1 1
 1
7
5
 6
16 20 18 7 14 2
17 12 4 10 7 4

705
 917
 1
 9
 5
 741

def dfs(cx, cy, board, n, possibles, visited, cv, dir):
    # print cx, cy
    if visited == n * 2:
        possibles.append(cv)
    else:
        if cy == n - 1:
            v1 = visited*board[cx][cy]
            v2 = (visited + 1)*board[(cx + 1) % 2][cy]
            dfs((cx + 1) % 2, cy - 1, board, n, possibles, visited+2, cv + v1 + v2, -1)
        else:
            dfs(cx, cy+dir, board, n, possibles, visited + 1, cv + visited * board[cx][cy], dir)
            if visited % 2 == 0:
                flag = visited % 4 == 0 and cx == 0 and cy == visited/ 2
                flag = flag | ((visited + 2) % 4 == 0 and cx == 1 and cy == visited / 2)
                if flag:
                    dfs((cx + 1) % 2, cy, board, n, possibles, visited + 1, cv + visited * board[cx][cy], dir)


n = int(raw_input())
first = raw_input().split()
second = raw_input().split()
fn = [int(x) for x in first]
sn = [int(x) for x in second]
board = [fn, sn]
possibles = []
dfs(0, 0, board, n, possibles, 0, 0, 1)
print max(possibles)