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

N = input()
fst = [int(v) for v in raw_input().split()]
snd = [int(v) for v in raw_input().split()]
S1 = 0
S2 = 0
for i in range(N):
    S1 += i*fst[i] + (i+N)*snd[N-i-1]

x,y = 0, 0
v = 0
b = [fst, snd]
for _ in range(N):
    S2 += v*b[x][y]
    x = 0 if x else 1
    S2 += (v + 1)*b[x][y]
    y += 1
    v += 2
print max(S1, S2)
