#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(ll i=a;i inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; int const MOD = 1e6+7; int main() { ll N; cin >> N; #define EXPR(i) ((i+1) % MOD * (N-i+1) % MOD - 1) % MOD ll ans = 0; REP(i, max(0LL, N/2-10), min(N/2+10, N)) { maximize(ans, EXPR(i)); } cout << ans << endl; return 0; }