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


def mi():
	return map(int, input().split())

n = int(input())
a = list(mi())
b = list(mi())

i = 0
o = [[0]*2 for i in range(n)]
o[0][1] = 1
ori =[[0]*2 for i in range(n)]
for i in range(1,n):
	if i%2:
		o[i][0] = o[i-1][0]+3
		o[i][1] = o[i-1][1]+1
	else:
		o[i][1] = o[i-1][1]+3
		o[i][0] = o[i-1][0]+1
ori[0][1] = 2*n-1
for i in range(1,n):
	ori[i][0] = ori[i-1][0]+1
	ori[i][1] = 2*n-1-ori[i][0]
m = max(a)
m = max(m, max(b))
if m in a:
	i = a.index(m)
	if ori[i][0]>o[i][0]:
		f = 1
	else:
		f = 0
else:
	i = b.index(m)
	if ori[i][1]>o[i][1]:
		f = 1
	else:
		f = 0
if f:
	s = 0
	for i in range(n):
		s+=ori[i][0]*a[i]+ori[i][1]*b[i]
else:
	s = 0
	for i in range(n):
		s+=o[i][0]*a[i]+o[i][1]*b[i]
print (s)