#include long long MOD = (long long) 1e9 + 7; long long pow(long long a, long long n) { long long ret = 1; for (; n > 0; n >>= 1, a = a * a % MOD) { if (n % 2 == 1) { ret = ret * a % MOD; } } return ret; } long long inv(long long a) { return pow(a, MOD - 2); } int main() { long N, n1 = 0, n2 = 0, n3 = 0; std::cin >> N; N -= 4; if (N % 3 == 0) n3 = 1; n2 = N / 2 + 1 - n3; N %= MOD; n1 = (N + 2) * (N + 1) % MOD * inv(2) % MOD; n1 -= n3 + 3 * n2 % MOD; n1 = n1 * inv(6) % MOD; if (n1 < 0) n1 += MOD; long long ans = (n3 + n2 + n1) % MOD; std::cout << ans << std::endl; }