#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) const ll mod = 1000000007; ll t(ll n) { n %= mod; return n * (n + 1) / 2 % mod; } int main() { //cout.precision(10); cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; ll ans = 0; /* for(ll i = 1; i <= N; i++) { for(ll j = 1; j <= i; j++) { for(ll k = 1; k <= j; k++) { if(i + j + k + 1 == N) ans++; } } } */ N -= 4; ans = 6 * t(N / 6) % mod; ans += (N % 6) * ((N / 6 + 1) % mod) % mod; if(N % 6 == 0) ans++; ans %= mod; cout << ans << endl; return 0; }