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 = int(input()) 
arr = []
for i in range(2):
    arr.append([int(j) for j in input().split()])

#первый способ прохода
firstSum = 0
for i in range(n):
        firstSum += arr[0][i]*i + arr[1][n-i-1]*(i+n)

#второй способ прохода
secondSum = 0
for i in range(0, n, 2):
        secondSum += arr[0][i]*2*i + arr[1][i]*(2*i+1)
        if((i+1)<n):
            secondSum += arr[0][i+1]*(2*i+3) + arr[1][i+1]*(2*i+2)

if(firstSum>=secondSum): print(firstSum)
else: print(secondSum)
