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

public class Mashrooms{
  public static void main(String args[]){
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int field[][] = new int[2][n];

    for(int i = 0; i < 2; i++){
      for(int j = 0; j < n; j++){
        field[i][j] = in.nextInt();
      }
    }

    int total1 = 0;
    for(int i = 0; i < n; i++){
      total1 += (i) * field[0][i];
    }
    for(int i = n - 1; i >= 0; i--){
      total1 += (2 * n - i - 1) * field[1][i];
    }

    int total2 = 0;
    int move = 0;
    for(int i = 0; i < n; i++){
      total2 += move * field[0][i];
      move += (i % 2) == 0 ? 3 : 1;
    }
    System.out.println();
    move = 1;
    for(int i = 0; i < n; i++){
      total2 += move * field[1][i];
      move += (i % 2) == 1 ? 3 : 1;
    }
    System.out.print(Math.max(total1, total2));

    in.close();
  }
}
