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

public class Major {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int first[] = new int[n + 1];
        int second[] = new int[n + 1];
        StringTokenizer st = new StringTokenizer(br.readLine());
        for(int i = 1;i <= n;i++)
            first[i] = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        for(int i = 1;i <= n;i++)
            second[i] = Integer.parseInt(st.nextToken());
        long ans = 0, cnt = 0;
        for(int i = 1;i <= n;i++){
            cnt += first[i] *1L* (i - 1);
            cnt += second[i]*1L*(2*n - i);
        }
        ans = cnt;
        cnt = 0;
        for(int i = 1;i <= n;i++){
            cnt += second[i] *1L* i;
            cnt += first[i] * (2*n + 1 - i);
        }
        ans = Math.max(ans, cnt - first[1] * 1L * 2 * n);
        cnt = 0;
        for(int i = 1;i < n;i++){
            if((i & 1) == 0){
                cnt += first[i]*1L*(2*i - 1) + first[i + 1]*1L*(2*i);
            }
            else {
                cnt += second[i]*1L*(2*i - 1) + second[i + 1]*1L*(2*i);
            }
            //System.out.println(cnt + " " + i);
        }
        if((n & 1) == 1)
            cnt += second[n] *1L* (2*n - 1);
        else cnt += first[n] * 1L * (2*n - 1);
        ans = Math.max(ans, cnt);
        System.out.println(ans);
    }
}
