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.
import java.io.*;
import java.util.*;

public class C implements Runnable{
	public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}

	public void run() {
//		try { new TestGenerator(); } catch (Exception e) {}
		FastScanner fs = new FastScanner();
//		try { fs = new FastScanner("testdata.out"); } catch (Exception e) {}
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int[][] a = new int[2][n];
		for(int i = 0; i < 2; i++)
			a[i] = fs.nextIntArray(n);
		
		if(n == 1) {
			out.println(a[1][0]);
			out.close();
			return;
		}
		
		long[] sums = new long[n];
		sums[n-1] = a[1][n-1]+a[0][n-1];
		for(int i = n-2; i >= 0; i--)
			sums[i] = sums[i+1] + a[1][i]+a[0][i];
		
		long[][] vs1 = new long[2][n];
		long x = 0;
		for(int j = 1, time = 2; j >= 0; j--) {
			if(j == 1) {
				for(int i = 1; i < n; i++, time++) {
					x += (long)(time)*a[j][i];
					vs1[j][i] = (long)(time)*a[j][i];
				}
			}
			else {
				for(int i = n-1; i > 0; i--, time++) {
					x += (long)(time)*(a[j][i]);
					vs1[j][i] = (long)(time)*a[j][i];
				}
			}
		}
		long[] bottom = new long[n];
		bottom[0] = x;
		for(int i = 2, freq = 0; i < n; i += 2) {
			//delete the contribution of i and i-1
			for(int k = 0; k < 2; k++) {
				for(int j = i - 1; j <= i; j++) {
					x -= vs1[k][j] + (long)freq*a[k][j];
				}
			}
			freq += 2;
			long pref = i+1 < n ? sums[i+1] : 0;
			x += 2L*pref;
			bottom[i] = x;
		}

		long[] top = new long[n];
		long[][] vs2 = new long[2][n];
		long y = 0;
		for(int j = 0, time = 4; j < 2; j++) {
			if(j == 0) {
				for(int i = 2; i < n; i++, time++) {
					y += (long)time * a[j][i];
					vs2[j][i] = (long)time * a[j][i];
				}
			}
			else {
				for(int i = n-1; i > 1; i--, time++) {
					y += (long)time * a[j][i];
					vs2[j][i] = (long)time * a[j][i];
				}
			}
		}
		top[1] = y;
		for(int i = 3, freq = 0; i < n; i += 2) {
			for(int k = 0; k < 2; k++) {
				for(int j = i - 1; j <= i; j++) {
					y -= vs2[k][j] + (long)freq*a[k][j];
				}
			}
			freq += 2;
			long pref = i + 1 < n ? sums[i+1] : 0;
			y += 2L*pref;
			top[i] = y;
		}

//		System.out.println(Arrays.toString(top));
//		System.out.println(Arrays.toString(bottom));
		
		long res = 0;
		long sum = 0;
		int z = 0;
		for(int i = 0, time = 0; i < n; i++) {
			sum += (long)(time++)*a[z][i];
			if(z == 0)
				res = Math.max(res, sum+top[i]);
			else
				res = Math.max(res, sum + bottom[i]);

//			System.out.println(i + " " + z + " " + sum);
			
			sum += (long)(time++)*a[z^1][i];
			if(z == 0)
				res = Math.max(res, sum+bottom[i]);
			else
				res = Math.max(res, sum+top[i]);
			
//			System.out.println(i + " " + z + " " + sum);
//			System.out.println();
			
			z ^= 1;
		}
		
		long ret = 0;
		for(int j = 0, time = 0; j < 2; j++) {
			if(j == 0) {
				for(int i = 0; i < n; i++, time++) {
					ret += (long)(time)*a[j][i];
				}
			}
			else {
				for(int i = n-1; i >= 0; i--, time++) {
					ret += (long)(time)*a[j][i];
				}
			}
		}
		res = Math.max(res, ret);
		out.println(res);
		
//		out.println(rec(0, 0, n, 0, a, new boolean[2][n]));
		
		out.close();
	}
	
	int[] dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
	
	long rec(int x, int y, int n, int time, int[][] a, boolean[][] vis) {
		vis[x][y] = true;
		long res = time*a[x][y];
		long run = 0;

//		boolean print = x == 0 && y == 2;
		for(int d = 0; d < 4; d++) {
			int nx = x + dx[d];
			int ny = y + dy[d];
			if(!good(nx, ny, n)) continue;
			if(vis[nx][ny]) continue;
			vis[nx][ny] = true;
			long ret = rec(nx, ny, n, time+1, a, vis);
//			if(ret == 1094 && print) {
//				System.out.println(nx + " " + ny + " " + time);
//			}
			run = Math.max(run, ret);
			vis[nx][ny] = false;
		}
		vis[x][y] = false;
//		if(print) {
//			System.out.println("R " + run);
//		}
		return res+run;
	}
	
	boolean good(int x, int y, int n) {
		return x >= 0 && y >= 0 && x < 2 && y < n;
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}