#include <bits/stdc++.h>   using namespace std;   int n, a[2][300004];   long long sf[2][300004];   long long ca[2][300004];   int w33ha() {     memset(sf, 0, sizeof(sf));     memset(ca, 0, sizeof(ca));     for (int t = 0; t <= 1; t++)       for (int i = 1; i <= n; i++) scanf( %d , &a[t][i]);     for (int t = 0; t <= 1; t++) {       sf[t][0] = 0;       for (int i = 1; i <= n; i++) {         sf[t][i] = sf[t][i - 1] + a[t][i];       }     }     for (int t = 0; t <= 1; t++) {       ca[t][n + 1] = 0;       for (int i = n; i >= 1; i--) {         long long nob = ((n - i + 1LL) << 1) - 1;         ca[t][i] = ca[t][i + 1];         ca[t][i] += nob * a[1 - t][i];         ca[t][i] += sf[t][n] - sf[t][i] + sf[1 - t][n] - sf[1 - t][i];       }     }     long long ans = 0, now = 0;     for (int i = 1; i <= n; i++) {       long long delta =           ((i - 1LL) << 1) * (sf[0][n] - sf[0][i - 1] + sf[1][n] - sf[1][i - 1]);       if (i & 1) {         ans = max(ans, now + delta + ca[0][i]);         now += 1LL * ((i - 1LL) << 1) * a[0][i] +                1LL * ((i - 1LL) << 1 | 1) * a[1][i];       } else {         ans = max(ans, now + delta + ca[1][i]);         now += 1LL * ((i - 1LL) << 1) * a[1][i] +                1LL * ((i - 1LL) << 1 | 1) * a[0][i];       }     }     printf( %lld n , ans);     return 0;   }   int main() {     while (scanf( %d , &n) != EOF) w33ha();     return 0;   }   