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())
row1=[int(i) for i in input().split()]
row2=[int(i) for i in input().split()]
mat=[row1,row2]
sum1=0
sum2=0
sum3=0
k=0
p=0
q=0
while k!=2*n:
	if q<=n-1:
		sum1+=mat[p][q]*k
		q+=1
		k+=1
	elif q>n-1:
		p=1
		sum1+=mat[p][2*n-q-1]*k
		q+=1
		k+=1

k=0
p=0
q=0
while k!=2*n:
	sum2+=mat[p][q]*k
	k+=1
	if q%2==0 and p==0:
		p=1
	elif q%2==0 and p==1:
		q+=1
	elif q%2!=0 and p==0:
		q+=1
	elif q%2!=0 and p==1:
		p=0





p=1
q=0
c=1
while c!=2*n:
	if q<=n-1:
		sum3+=mat[p][q]*c
		q+=1
		c+=1
	elif q>n-1:
		p=0
		sum3+=mat[p][2*n-q-1]
		q+=1
		c+=1
	

print(max(sum1,sum2,sum3))








