6
12 8 12 17 20 5
17 4 8 8 8 4
 6
4 1 12 9 3 11
12 20 19 12 19 11
 1
1
1
 2
1 2
1 1
 1
7
5
 6
16 20 18 7 14 2
17 12 4 10 7 4

705
 917
 1
 9
 5
 741

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
constexpr int N = 2e5 + 1;
constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 9;
ll arr[2][N], sum[3], n, t = 0;
bool func(ll& i, ll& j, ll& t) {
  sum[0] += arr[i][j] * t;
  if (i == 0) {
    if (j % 2)
      j++;
    else
      i = 1;
  } else {
    if (j % 2)
      i = 0;
    else
      j++;
  }
  t++;
  if (t == 2 * n) return false;
  return true;
}
void Solve() {
  cin >> n;
  for (int j = 0; j < 2; j++)
    for (int i = 0; i < n; i++) cin >> arr[j][i];
  for (ll i = 0, j = 0; func(i, j, t);)
    ;
  for (int i = 1; i < n; i++) {
    sum[1] += arr[0][i] * i;
  }
  for (int i = n - 1; i >= 0; i--) {
    sum[1] += arr[1][i] * (n - 1 + n - i);
  }
  for (int i = 1; i <= n; i++) {
    sum[2] += arr[1][i - 1] * i;
  }
  for (int i = n - 1; i > 0; i--) {
    sum[2] += arr[0][i] * (n + n - i);
  }
  cout << max({sum[0], sum[1], sum[2]});
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Solve();
  return 0;
}
