#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, i, j;
  cin >> n;
  long long a[2][n], s[n], r[n], p, k[n];
  for (i = 0; i < n; i++) cin >> a[0][i];
  for (i = 0; i < n; i++) cin >> a[1][i];
  if (n == 1) {
    cout << a[1][0];
    return 0;
  }
  p = 0;
  for (i = n - 1; i >= 0; i--) {
    p += (a[0][i] + a[1][i]);
    s[i] = p;
  }
  if (n % 2) {
    r[n - 1] = (2 * n - 2) * a[0][n - 1] + (2 * n - 1) * a[1][n - 1];
    r[n - 2] = (2 * n - 1) * a[0][n - 2] + (2 * n - 4) * a[1][n - 2] +
               (2 * n - 3) * a[1][n - 1] + (2 * n - 2) * a[0][n - 1];
  } else {
    r[n - 1] = (2 * n - 1) * a[0][n - 1] + (2 * n - 2) * a[1][n - 1];
    r[n - 2] = (2 * n - 4) * a[0][n - 2] + (2 * n - 1) * a[1][n - 2] +
               (2 * n - 2) * a[1][n - 1] + (2 * n - 3) * a[0][n - 1];
  }
  for (i = n - 3; i >= 0; i--) {
    if (i % 2) {
      r[i] = (2 * i) * a[1][i] + (2 * i + 1) * a[1][i + 1] +
             (2 * n - 1) * a[0][i] + (2 * n - 2) * a[0][i + 1];
      r[i] += (r[i + 2] - 2 * s[i + 2]);
    } else {
      r[i] = (2 * i) * a[0][i] + (2 * i + 1) * a[0][i + 1] +
             (2 * n - 1) * a[1][i] + (2 * n - 2) * a[1][i + 1];
      r[i] += (r[i + 2] - 2 * s[i + 2]);
    }
  }
  k[n - 1] = r[n - 1];
  for (i = n - 2; i >= 0; i--) {
    if (i % 2)
      p = 2 * i * a[1][i] + (2 * i + 1) * a[0][i];
    else
      p = 2 * i * a[0][i] + (2 * i + 1) * a[1][i];
    k[i] = max(r[i], p + k[i + 1]);
  }
  cout << k[0];
  return 0;
}
