#include <bits/stdc++.h>
using namespace std;
long long sum[300005], sm[300005], tsum[300005], su[300005];
long long a[3][300005];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= 2; i++) {
    for (long long j = 1; j <= n; j++) cin >> a[i][j];
  }
  sum[n] = a[2][n];
  tsum[n] = a[1][n] + a[2][n];
  for (long long i = n - 1; i >= 1; i--) {
    tsum[i] = tsum[i + 1] + a[1][i] + a[2][i];
  }
  for (long long i = n - 1; i >= 1; i--) {
    sum[i] = sum[i + 1] + tsum[i + 1] + (2 * (n - i) + 1) * a[2][i];
  }
  sm[1] = a[2][1];
  for (long long i = 2; i <= n; i++) {
    if (i % 2 == 0)
      sm[i] = sm[i - 1] + (2 * i - 2) * a[2][i] + (2 * i - 1) * a[1][i];
    else
      sm[i] = sm[i - 1] + (2 * i - 2) * a[1][i] + (2 * i - 1) * a[2][i];
  }
  su[n] = a[1][n];
  for (long long i = n - 1; i >= 1; i--) {
    su[i] = su[i + 1] + tsum[i + 1] + (2 * (n - i) + 1) * a[1][i];
  }
  long long ans = sum[1];
  for (long long i = 3; i <= n; i += 2) {
    ans = max(ans, sm[i - 1] + (2 * i - 2) * tsum[i] + sum[i]);
  }
  for (long long i = 2; i <= n; i++) {
    ans = max(ans, sm[i]);
  }
  for (long long i = 2; i <= n; i += 2) {
    ans = max(ans, sm[i - 1] + (2 * i - 2) * tsum[i] + su[i]);
  }
  cout << ans;
}
