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 collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        print(*args, **kwargs, file=sys.stderr)
    dprint('debug mode')
except ModuleNotFoundError:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
def memo(func):  
    cache={}  
    def wrap(*args):  
        if args not in cache:  
            cache[args]=func(*args)  
        return cache[args]  
    return wrap

    
N, = getIntList()
z1 = getIntList()
z2 = getIntList()

zz = [z1,z2]

td = [0 for x in range(N+1) ]
dp = [td, td.copy()]

@memo
def findU(c, ifup):
    
    if c== N:
        return 0,0
    else:
        t1,t2 = findU(c+1,ifup)
        r1 = t1 + zz[0][c] + zz[1][c]
        r2 = t1 + t2 + zz[1-ifup][c] * ( (N-c) *2 -1 )
        return r1,r2
    
_, res = findU(0,0)

total = 0
ifup = 0
lastnow =0
for i in range(2*N-1):
    time = i+1
    now = (i+1)//2
    ifup = 1 - i//2 %2
    total += time* zz[ifup][now]
    if now == lastnow:
        t1, t2 = findU(now+1, ifup)
        temp = total + t2
        res = max(res,temp)
    lastnow = now

print(res)
    







