#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> a[i];
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> b[i];
  long long dpd[n], dpu[n];
  long long pa[n + 1], pb[n + 1];
  pa[0] = pb[0] = 0;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    pa[i + 1] = pa[i] + a[i];
    pb[i + 1] = pb[i] + b[i];
  }
  dpd[n - 1] = 0;
  dpu[n - 1] = 0;
  for (long long i = n - 2; i >= 0; i--) {
    dpd[i] = dpd[i + 1] + (pa[n] - pa[i + 2]) + (pb[n] - pb[i + 2]) + b[i + 1] +
             ((2 * (n - 1 - i)) * a[i + 1]);
    dpu[i] = dpu[i + 1] + (pa[n] - pa[i + 2]) + (pb[n] - pb[i + 2]) + a[i + 1] +
             ((2 * (n - 1 - i)) * b[i + 1]);
  }
  long long curr = 0;
  long long ans = 0;
  long long p = 1;
  char c = 'U';
  long long i = 0;
  while (i < (2 * n)) {
    if (c == 'U') {
      curr += (i * a[(i) / 2]);
      long long r = 0;
      if (p == 1) {
        r = ((2 * n) - 1) * b[i / 2];
      }
      ans = max(ans, r + curr + dpu[i / 2] +
                         (i) * ((pa[n] - pa[(i / 2) + 1]) +
                                (pb[n] - pb[(i / 2) + 1])));
      p = (p + 1) % 2;
      if (p == 0) c = 'D';
    } else {
      curr += (i * b[(i) / 2]);
      long long r = 0;
      if (p == 1) {
        r = ((2 * n) - 1) * a[i / 2];
      }
      ans = max(ans, r + curr + dpd[i / 2] +
                         (i) * ((pa[n] - pa[(i / 2) + 1]) +
                                (pb[n] - pb[(i / 2) + 1])));
      p = (p + 1) % 2;
      if (p == 0) c = 'U';
    }
    i++;
  }
  cout << ans << "\n";
}
