// yukicoder My Practice // author: Leonardone @ NEETSDKASU #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; // const ll MD = 1000000007LL; const ull UMD = 1000000007ULL; map > mp; ull cmb(ull n, ull c) { c = min(c, n - c); auto x = mp.find(n); if (x != mp.end()) { auto y = x->second.find(c); if (y != x->second.end()) { return y->second; } } ull r = 1ULL; for (ull i = 1ULL; i <= c; i++) { r *= n--; r /= i; } r %= UMD; mp[c][n] = r; return r; } ull fnc(ll n) { ull c = 0ULL; ull i = 0ULL; if (n > 0LL && (n & 1LL)) { i = 1ULL; n -= 3LL; } ll d = n >> 1; while (d >= 0LL) { c = (c + cmb(ull(d) + i, i)); i += 2ULL; d -= 3LL; if ((d & 1023LL) == 512LL) continue; c %= UMD; } return c; } void solve() { ll n; cin >> n; ull ans = (((fnc(n) + fnc(n - 1)) % UMD) + fnc(n - 2)) % UMD; cout << ans << endl; } int main() { solve(); return 0; }