#include #include #include #include #include #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; /*-------------------------------------------------*/ int main() { cin.tie(0); ios::sync_with_stdio(false); // freopen("input.txt", "r", stdin); // int n; cin >> n; // vector city; // FOR(i, 1, n + 1) city.emplace_back(i); // vector root(n); // long long ans = LINF; // do { // long long money = 0; // REP(i, n - 1) { // money += (city[i] * city[i + 1]) + (city[i + 1] - city[i]); // } // money += (city[n - 1] * city[0]) + (city[0] - city[n - 1]); // if (money < ans) { // ans = money; // root = city; // } // } while (next_permutation(ALL(city))); // cout << ans << '\n'; // REP(i, n) cout << root[i] << ' '; long long n; cin >> n; if (n == 1) { cout << 0 << '\n'; return 0; } if (n == 2) { cout << 4 << '\n'; return 0; } long long ans = 0, mae = 1, ushiro = n - 1; if (n & 1) { REP(i, (n + 1) / 2) { ans += (mae * ushiro) + (ushiro - mae); mae += 2; mae = min(mae, n); if (i < (n - 1) / 2) { ans += (mae * ushiro) + (mae - ushiro); ushiro -= 2; ushiro = max(ushiro, 1LL); } } } else if (n % 4 == 0) { int cnt = 0; while (mae < ushiro) { ans += (mae * ushiro) + (ushiro - mae); mae += 2; ++cnt; if (mae == ushiro) { ans += (ushiro * (mae - 1)) + (mae - 1 - ushiro); ++cnt; ++mae; --ushiro; break; } ans += (mae * ushiro) + (mae - ushiro); ushiro -= 2; ++cnt; } while (cnt < n) { ans += (mae * ushiro) + (mae - ushiro); ushiro -= 2; ushiro = max(ushiro, 1LL); ++cnt; if (cnt == n) break; ans += (mae * ushiro) + (ushiro - mae); mae += 2; mae = min(mae, n); ++cnt; } } else { int cnt = 0; while (mae < ushiro) { ans += (mae * ushiro) + (ushiro - mae); mae += 2; ans += (mae * ushiro) + (mae - ushiro); ushiro -= 2; cnt += 2; if (mae == ushiro) { ans += (mae * (ushiro + 1) + (ushiro + 1 - mae)); ++cnt; ++mae; --ushiro; break; } } while (cnt < n) { ans += (mae * ushiro) + (ushiro - mae); mae += 2; mae = min(mae, n); ++cnt; if (cnt == n) break; ans += (mae * ushiro) + (mae - ushiro); ushiro -= 2; ushiro = max(ushiro, 1LL); ++cnt; } } cout << ans << '\n'; return 0; }