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

#include <bits/stdc++.h>
using namespace std;
int n;
long long int ans1, ans2;
int main() {
  cin >> n;
  long long int ai, bi;
  ans1 = ans2 = 0;
  long long int x = 0, y = 1;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &ai);
    ans1 += i * ai;
    ans2 += x * ai;
    if (i & 1)
      x += 1;
    else
      x += 3;
  }
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &bi);
    ans1 += (n + n - 1 - i) * bi;
    ans2 += y * bi;
    if (i & 1)
      y += 3;
    else
      y += 1;
  }
  cout << max(ans1, ans2) << endl;
  return 0;
}
