#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; ll ans = 0; for(ll i = 1; i <= n; i++){ ll cnt = i % 3, d = 1; if(cnt == 0) cnt = 3; while(cnt--) d *= i; ans += d; } cout << ans << '\n'; }