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

f = lambda: map(int, input().split())
n = int(input())
a = []
for i in range(2):
    a.append(list(f()))
res = [0, 0, 0]
j = 0
x = 0
for i in range(n):
    if j:
        res[0] += a[1][i] * x
        x += 1
        res[0] += a[0][i] * x
    else:
        res[0] += a[0][i] * x
        x += 1
        res[0] += a[1][i] * x
    j = not j
    x += 1
x = 0
for i in range(n):
    res[1] += a[0][i] * x
    x += 1
for i in range(n - 1, -1, -1):
    res[1] += a[1][i] * x
    x += 1
x = 2
res[2] += a[1][0]
for i in range(1, n):
    res[2] += a[1][i] * x
for i in range(n - 1, 0, -1):
    res[2] += a[0][i] * x
print(max(res))