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

# import sys
# sys.stdin=open('F:\\C\\Script\\input.txt','r')
# sys.stdout=open('F:\\C\\Script\\output.txt','w')
# sys.stdout.flush()

I = lambda:list(map(int,input().split()))
# MOD = 1000000007
n , =I()
a = I()
b = I()
c = [0]*5
c[0] = (2*n - 1)*b[0]
c[1] = 1*b[0]
c[2] = 1*b[0]
c[3] = 0
c[4] = 1*b[0] + 2*b[1] + 3*a[1]
for i in range(1,n):
	c[0] += i*a[i] + (2*n - i - 1)*b[i]
	c[1] += (i+1)*b[i] + (2*n - i)*a[i]
	if i%2:
		c[2] += (2*i)*b[i] + (2*i + 1)*a[i]
		c[3] += (2*i)*b[i] + (2*i - 1)*a[i]
	else:
		c[2] += (2*i + 1)*b[i] + (2*i)*a[i]
		c[3] += (2*i - 1)*b[i] + (2*i)*a[i]
	if i > 1:
		c[4] += (i + 2)*a[i] + (2*n-i-1)*b[i]
print (max(c))
# print (c)