#include #include #include #include using namespace std; int main() { /* int n; cin >> n; vector p(n); for (int i = 0; i < n; i++) { p[i] = i + 1; } int ans = 1e9; do { int cost = 0; for (int i = 0; i < n; i++) { cost += p[i] * p[(i + 1) % n]; } ans = min(ans, cost); } while (next_permutation(p.begin(), p.end())); do { int cost = 0; for (int i = 0; i < n; i++) { cost += p[i] * p[(i + 1) % n]; } if (cost == ans) { for (int i = 0; i < n; i++) { cout << p[i] << ' '; } cout << '\n'; } } while (next_permutation(p.begin(), p.end())); 1 9 3 7 5 6 4 8 2 10 */ int n; cin >> n; vector L, R; int l = 1, r = n; for (int i = 1; i <= n; i++) { switch ((i - 1) % 4) { case 0: L.push_back(l++); break; case 1: R.push_back(r--); break; case 2: R.push_back(l++); break; case 3: L.push_back(r--); break; } } reverse(R.begin(), R.end()); L.insert(L.end(), R.begin(), R.end()); long long ans = 0; for (int i = 0; i < n; i++) { ans += (long long)L[i] * L[(i + 1) % n]; } cout << ans << '\n'; }