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

length = int(input())
sum1, sum2 = 0, 0
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
for i in range(length):
    sum1 += i * row1[i] + (2 * length - i - 1) * row2[i]
for i in range(length // 2):
    sum2 += (4 * i + 1) * row2[i] + (4 * i + 2) * row2[i + 1] + \
            (4 * i) * row1[i] + (4 * i + 3) * row1[i + 1]
if length % 2 == 1:
    sum2 += (2 * length - 2) * row1[-1] + (2 * length - 1) * row2[-1]
print(max(sum1, sum2))