#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const __int128 N = 3e5 + 5;
__int128 sq(__int128 x) { return x * x; }
__int128 abs(__int128 x) { return x *= (x < 0 ? -1 : 1), x; }
__int128 min(__int128 a, __int128 b) { return (a < b ? a : b); }
__int128 max(__int128 a, __int128 b) { return (a > b ? a : b); }
ostream& operator<<(ostream& os, __int128 zz) {
  if (zz == 0) return os << "0", os;
  bool ok = 0;
  if (zz < 0) ok = 1, zz *= -1;
  string res;
  while (zz > 0) res += (zz % 10 + '0'), zz /= 10;
  res += (ok ? "-" : "");
  return reverse(res.begin(), res.end()), os << res, os;
}
istream& operator>>(istream& is, __int128& zz) {
  string s;
  is >> s;
  if (!s.size()) return is;
  reverse(s.begin(), s.end());
  bool ok = 0;
  if (s.back() == '-') ok = true, s.pop_back();
  zz = 0;
  while ((__int128)s.size()) zz = zz * 10 + (s.back() - '0'), s.pop_back();
  if (ok) zz *= -1;
  return is;
}
__int128 a[2][N], s1[2][N], s2[2][N], s3[2][N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  __int128 n;
  cin >> n;
  for (__int128 i = 0; i < 2; i++) {
    for (__int128 j = 1; j <= n; j++) cin >> a[i][j];
  }
  for (__int128 i = n; i >= 1; i--) {
    s1[0][i] = (a[0][i] * (i - 1));
    s1[0][i] += s1[0][i + 1];
    s1[1][i] = a[1][i] * (n + n - i);
    s1[1][i] += s1[1][i + 1];
  }
  for (__int128 i = n; i >= 1; i--) {
    s2[1][i] = (a[1][i] * i);
    s2[1][i] += s2[1][i + 1];
    s2[0][i] = a[0][i] * (n + n - i + 1);
    s2[0][i] += s2[0][i + 1];
    s3[0][i] = a[0][i];
    s3[1][i] = a[1][i];
    s3[0][i] += s3[0][i + 1];
    s3[1][i] += s3[1][i + 1];
  }
  __int128 ans = s1[0][1] + s1[1][1], res = 0;
  __int128 cnt = 0;
  for (__int128 i = 1; i <= n; i++) {
    if (i & 1) {
      res += (cnt++) * a[0][i];
      res += (cnt++) * a[1][i];
      __int128 t = (i + 1) * s3[1][i + 1];
      __int128 t1 = s2[1][i + 1] - t;
      t1 += cnt * s3[1][i + 1];
      t = s3[0][i + 1] * (i + 1);
      t1 += (s2[0][i + 1] - t);
      t1 += (cnt * s3[0][i + 1]);
      ans = max(ans, res + t1);
    } else {
      res += (cnt++) * a[1][i];
      res += (cnt++) * a[0][i];
      __int128 t = i * s3[1][i + 1];
      __int128 t1 = s1[1][i + 1] - t;
      t1 += cnt * s3[1][i + 1];
      t = s3[0][i + 1] * i;
      t1 += (s1[0][i + 1] - t);
      t1 += (cnt * s3[0][i + 1]);
      ans = max(ans, res + t1);
    }
  }
  cout << ans << "\n";
  return 0;
}
