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

i=int(input())
m1=[int(i) for i in input().split()]
m2=[int(i) for i in input().split()]
S1=0
S2=0
for j in range(i):
    S1+=(j*m1[j])
    S1+=((i+j)*m2[-j-1])
    S2+=((2*j+(j%2))*m1[j])
    S2+=(((2*j+((j+1)%2)))*m2[j])
print(max(S1,S2))