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())
a = list(map(int,input().split(' ')))
b = list(map(int,input().split(' ')))
c = [[],[]]
c0 = [[],[]]
c1 = [[],[]]

sum0 = 0
for i in range(2*n):
  if i<n:
    sum0 += i*a[i]
    c[0].append(sum0)
  else:
    sum0 += (i)*b[2*n-i-1]
    c[1].append(sum0)
c[1].reverse()
for i in range(2,2*n):
  if i<=n:
    c[1][i-1] = sum0 - c[1][i-1]
  else:
    c[0][2*n-i] = sum0 - c[0][2*n-i]

sum00 = 0
for i in range(1,2*n):
  if i<=n:
    sum00 += i*b[i-1]
    c0[1].append(sum00)
  else:
    sum00 += (i)*a[2*n-i]
    c0[0].append(sum00)
c0[0].append(0)
c0[0].reverse()
for i in range(n):
  c0[0][i] = sum00 - c0[0][i]
for i in range(n):
  c0[1][i] = sum00 - c0[1][i]

if sum00 > sum0:
  sum0 = sum00

sum1 = 0
for i in range(2*n):
  if i%4 in [0,3]:
    sum1 += i*a[(2*(i//4) + (0 if i%4==0 else 1))]
    c1[0].append(sum1)
  else:
    sum1 += i*b[(2*(i//4) + (0 if i%4==1 else 1))]
    c1[1].append(sum1)

if sum1 > sum0:
  sum0 = sum1
for i in range(n-3): 
  if n%2 == 0:
    su = c[1][n-2-i] - c[0][n-2-i] + c1[0][n-3-i]
  else:
    su = c0[0][n-2-i] - c0[1][n-2-i] + c1[1][n-3-i]
  if su > sum0:
    sum0 = su
                                              
print(sum0)                                             

