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

from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write


def in_arr():
    return map(int,raw_input().split())


def pr_num(n):
    stdout.write(str(n)+'\n')


def pr_arr(arr):
    for i in arr:
        stdout.write(str(i)+' ')
    stdout.write('\n')


range = xrange # not for python 3.0+

n=int(raw_input())
l1=in_arr()
l2=in_arr()
arr1=l1+list(reversed(l2))
arr2=l2+list(reversed(l1))
sm1=0
sm2=0
c=0
for i in range(2*n):
    sm1+=c*arr1[i]
    sm2+=c*arr2[i]
    c+=1
for i in range(1,n):
    l1[i]+=l1[i-1]
    l2[i]+=l2[i-1]  
ans=sm1
curr=0
val=(2*n)-1
for i in range(n):
    #print i,curr,sm1,sm2
    if i:
        p1=l1[i]-l1[i-1]
        p2=l2[i]-l2[i-1]
    else:
        p1=l1[i]
        p2=l2[i]
    if i%2==0:
        curr+=(2*i*p1)+((2*i+1)*p2)
    else:
        curr+=(2*i*p2)+((2*i+1)*p1)
    #print val,p1,p2,
    sm2-=val*p1
    sm1-=val*p2
    val-=2
    #print sm1,sm2
    sm1-=((l1[-1]-l1[i])+(l2[-1]-l2[i]))
    sm2-=((l1[-1]-l1[i])+(l2[-1]-l2[i]))
    if i%2:
        temp=curr+sm1
    else:
        temp=curr+sm2
    temp+=(i*(l1[-1]-l1[i]))
    temp+=(i*(l2[-1]-l2[i]))
    ans=max(ans,temp)
    #print i,curr,sm1,sm2
pr_num(ans)
