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().strip())

a = [int(x) for x in input().strip().split(' ')]
b = [int(x) for x in input().strip().split(' ')]

r1 = 0
r2 = 0
r3 = 0

n2 = 2 * n
for i in range(n):
    r1 += (a[i] * i + b[i] * (n2 - i - 1))
    
    if i == 0:
        r2 += b[i]
    else:
        r2 += (b[i] * (i + 1) + (n2 - i) * a[i])
    
    
    y = i << 1        
    if i % 2 == 0:
        r3 += (a[i] * y + b[i] * (y + 1))
    else:
        r3 += (a[i] * (y + 1) + b[i] * y)


if r3 >= r2:
    if r3 >= r1:
        print(r3)
    else:
        print(r1)
else:
    if r1 >= r2:
        print(r1)
    else:
        print(r2)
    