#include <bits/stdc++.h>
using namespace std;
int n, m, q;
long long f[2][300005], a[2][300005], s[2][300005], p, px, py;
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i <= 1; i++)
    for (int j = n - 1; j >= 0; j--) {
      px = i ^ 1;
      if (j % 2 != i) {
        s[i][j] = s[i][j + 1] + a[i][j];
        f[i][j] = f[i][j + 1] + a[i][j] * (j * 2 + 1);
      } else {
        s[i][j] = s[i][j + 1] + a[i][j] + a[px][j] + a[px][j + 1];
        f[i][j] = f[i][j + 1] - s[i][j + 1] * 2 + a[i][j] * (j * 2) +
                  a[px][j] * (n * 2 - 1) + a[px][j + 1] * (n * 2 - 2);
      }
    }
  px = 0;
  py = 0;
  p = 0;
  long long ans = 0;
  long long maxans = f[0][0];
  for (int i = 1; i < n * 2; i++) {
    p++;
    if (py % 2 == px)
      px ^= 1;
    else
      py++;
    maxans = max(maxans, ans + (long long)f[px][py]);
    ans += a[px][py] * p;
  }
  cout << maxans << endl;
}
