#include using namespace std; using ll = long long; const ll MOD = 1000000007; ll modpow(ll x, ll n, ll mod = MOD) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; n -= 4; ll total = (n + 2) % MOD * ((n + 1) % MOD) % MOD * ((MOD + 1) / 2) % MOD; ll ans = 0; if (n % 3 == 0) { ans++; total = (total + MOD - 1) % MOD; } ll hoge = (n / 2 + 1 - (n % 3 == 0)) % MOD; (ans += hoge) %= MOD; total = (total + MOD - hoge * 3 % MOD) % MOD; (ans += total * modpow(6, MOD - 2) % MOD) %= MOD; cout << ans << "\n"; return 0; }