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())
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
method1=0
method2=0
time1=0
time=0
for i in range(n):
    method1+=b[i]*time
    time+=1
for i in range(n):
    method1+=c[n-1-i]*time
    time+=1
for i in range(0,n,2):
    method2+=b[i]*time1
    time1+=1
    method2+=c[i]*time1
    time1+=1
    if(i+1>=n):
        break
    method2+=c[i+1]*time1
    time1+=1
    method2+=b[i+1]*time1
    time1+=1
if(method2>method1):
    print(method2)
else:
    print(method1)
