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 java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class VasyaAndMushshroom {

	//UPSOLVE
	final static int max = 300010;
		
	public static void main(String[] args) throws IOException {
		
		long a[] = new long[max];
		long b[] = new long[max];
		long suf[] = new long[max];
		long f1[] = new long[max];
		long f2[] = new long[max];
		int n;
		long ans = 0;
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());
		
		StringTokenizer st1 = new StringTokenizer(br.readLine());
		for (int i = 1; i <= n; ++ i) {
			a[i] = Long.parseLong(st1.nextToken());
		}
		
		StringTokenizer st2 = new StringTokenizer(br.readLine());
		for (int i = 1; i <= n; ++ i) {
			b[i] = Long.parseLong(st2.nextToken());
		}
		
		for (int i = n; i >= 1; -- i) {
			suf[i] = suf[i + 1] + a[i] + b[i];
		}
		f1[n] = (a[n] * (2 * n -1) + b[n] * 2 * n);
		f2[n] = (a[n] * (2L * n)) + b[n] * (2L * n - 1);
		
		for (int i = n - 1; i >= 1; -- i) {
			f1[i] = f1[i + 1] - suf[i + 1] + 2l * n * b[i] + (2L * i - 1L) * a[i];   
			f2[i] = f2[i + 1] - suf[i + 1] + 2L * n * a[i] + (2L * i - 1L) * b[i];
		}
		
		long ret = 0;
		for (int i = 1; i <= n + 1; ++ i) {
			if ((i & 1) == 1) {
				ans = Math.max(ans, ret + f1[i]);
			} else {
				ans = Math.max(ans, ret + f2[i]);
			}
			ret += ((i & 1) == 1) ? (2L * i - 1) * a[i] + (2L * i) * b[i] : (2L * i - 1) * b[i] + (2L * i) * a[i];
		}
		System.out.println(ans - suf[1]);

	}

}
