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

from sys import stdin

n = int(stdin.readline())

glade = [[0]*n]*2

for y in range(2):
    glade[y] = [int(x) for x in stdin.readline().split()]

best = 0
cur = 0

for t in range(n):
    cur += t*glade[0][t]
for t in range(n, 2*n):
    cur += t*glade[1][2*n - t - 1]

if cur > best:
    best = cur

cur = 0
for t in range(1, n+1):
    cur += t*glade[1][t-1]
for t in range(n+1, 2*n):
    cur += t*glade[0][2*n - t]

if cur > best:
    best = cur

cur = 0
y = 0
x = 0
updown = 1

for t in range(1, 2*n):
    if t%2 == 0:
        x += 1
    else:
        y += updown
        updown *= -1
    cur += t*glade[y][x]

if cur > best:
    best = cur

print(best)