Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cell Vasya knows how fast the mushrooms grow in this cell (more formally, how many grams of mushrooms grow in this cell each minute). Vasya spends exactly one minute to move to some adjacent cell. Vasya cannot leave the glade. Two cells are considered adjacent if they share a common side. When Vasya enters some cell, he instantly collects all the mushrooms growing there.

Vasya begins his journey in the left upper cell. Every minute Vasya must move to some adjacent cell, he cannot wait for the mushrooms to grow. He wants to visit all the cells exactly once and maximize the total weight of the collected mushrooms. Initially, all mushrooms have a weight of 0. Note that Vasya doesn't need to return to the starting cell.

Help Vasya! Calculate the maximum total weight of mushrooms he can collect.

Input

The first line contains the number n (1 ≤ n ≤ 3·105) — the length of the glade.

The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the growth rate of mushrooms in the first row of the glade.

The third line contains n numbers b1, b2, ..., bn (1 ≤ bi ≤ 106) is the growth rate of mushrooms in the second row of the glade.

Output

Output one number — the maximum total weight of mushrooms that Vasya can collect by choosing the optimal route. Pay attention that Vasya must visit every cell of the glade exactly once.

Examples

Input

3
1 2 3
6 5 4


Output

70


Input

3
1 1000 10000
10 100 100000


Output

543210

Note

In the first test case, the optimal route is as follows: 

<image> Thus, the collected weight of mushrooms will be 0·1 + 1·2 + 2·3 + 3·4 + 4·5 + 5·6 = 70.

In the second test case, the optimal route is as follows: 

<image> Thus, the collected weight of mushrooms will be 0·1 + 1·10 + 2·100 + 3·1000 + 4·10000 + 5·100000 = 543210.
n = int(input())
l = [[],[]]
for i in range(2) :
    l[i] = [int(i) for i in input().split(' ')]

pref = [[],[]]
for i in range(2) :
    pref[i].append(l[i][0])
    for j in range(1,n) :
        pref[i].append(pref[i][j-1] + l[i][j])

inc_pref = [[],[]]
tim_pref = [[],[]]
for i in range(2) :
    timer = 0
    tim_pref[i].append(0)
    inc_pref[i].append(timer*l[i][0])
    for j in range(1,n) :
        timer+=1
        inc_pref[i].append(inc_pref[i][j-1] + timer*l[i][j])
        tim_pref[i].append(timer)

inc_suff = [[],[]]
for i in range(2) :
    inc_suff[i] = [0 for _ in range(n)]
    timer = 0
    inc_suff[i][-1] = timer*l[i][-1]
    for j in range(n-2,-1,-1) :
        timer+=1
        inc_suff[i][j] = inc_suff[i][j+1] + timer*l[i][j]

i , j = 0 , 0
curr , ans = 0 , 0
timer = 0
while i < n :
    if j == 0:
        if i%2 == 0 :
            ans = max(ans , 
            curr + (timer - tim_pref[j][i])*(pref[j][-1] - (0 if i==0 else pref[j][i-1]))  + (inc_pref[j][-1] - (0 if i==0 else inc_pref[j][i-1]))
            + (n - i + timer)*(pref[j^1][-1] - (0 if i==0 else pref[j^1][i-1])) + inc_suff[j^1][i])
        else :
            ans = max(ans , 
            curr + (timer - tim_pref[j][i])*(pref[j][-1] - (0 if i==0 else pref[j][i-1]))  + (inc_pref[j][-1] - (0 if i==0 else inc_pref[j][i-1]))
            + (n - i + timer)*(pref[j^1][-1] - pref[j^1][i]) + (0 if i+1 == n else inc_suff[j^1][i+1]))
    else :
        if i%2 == 0 :
            ans = max(ans , 
            curr + (timer - tim_pref[j][i])*(pref[j][-1] - (0 if i==0 else pref[j][i-1]))  + (inc_pref[j][-1] - (0 if i==0 else inc_pref[j][i-1]))
            + (n - i + timer)*(pref[j^1][-1] - pref[j^1][i]) + (0 if i+1 == n else inc_suff[j^1][i+1]))
        else :
            ans = max(ans , 
            curr + (timer - tim_pref[j][i])*(pref[j][-1] - (0 if i==0 else pref[j][i-1]))  + (inc_pref[j][-1] - (0 if i==0 else inc_pref[j][i-1]))
            + (n - i + timer)*(pref[j^1][-1] - (0 if i==0 else pref[j^1][i-1])) + inc_suff[j^1][i])

    curr += timer*l[j][i]
    if (i%2 == 0 and j == 1) or (i%2 == 1 and j == 0) :
        i+=1
    else :
        j^=1
    timer+=1

print(ans)
