#include "bits/stdc++.h"
using namespace std;
// clang-format off
using i64 = int64_t;
using i32 = int32_t;
#define all(x) x.begin(), x.end()
#define int i64
template <class T, typename U> constexpr inline bool exist(const T &s, const U &e) { return s.find(e) != s.end(); }
template <class T> constexpr inline i32 SZ(const T &x) { return x.size(); }
template <class T> constexpr inline bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> constexpr inline bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
const char el = '\n'; const i32 MOD = 1e9 + 7, INF = 0x3f3f3f3f; const i64 INFLL = ((i64)INF << 32) | INF;

#ifdef LOCAL // debugging swiss knife
template <typename Ostream, typename Cont> enable_if_t<is_same<Ostream, ostream>::value, Ostream &> operator<<(Ostream &os, const Cont &v) { os << "{"; for (const auto &x : v) os << x << ", "; return os << "}"; }
template <typename Ostream, typename... Ts> Ostream &operator<<(Ostream &os, const pair<Ts...> &p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class... Args> void dbg_out(Args... args) { ((std::cerr << "\033[32m" << args << "\033[37m, "), ...); }
#define dbg(...) cerr << "\033[1;31m" << __LINE__ << ": [" << #__VA_ARGS__ << "]\033[37m  = ", dbg_out(__VA_ARGS__), cerr << "\033[0m" << endl;
#else
#define dbg(...) ;
#endif
// clang-format on
////////////////////////////////// TEMPLATE ENDS /////////////////////////////////
vector<vector<i32>> adj;
vector<i32> vis, color;

/*
 * Author : Jakob Kogler, Madhur Chauhan
 * Use : Modular Arithmetic
 * Time Complexity : O(1)
 * Space Complexity: O(1)
 * Usage Notes: Template argument is the modulus which is set to default: 1e9+7. A modular int can be created by:
 *                  Modular<> m=56; // creates a modular integer initialize to 56 in MOD = 1e9+7
 *                  using MInt = Modular<998244353>; // MInt can be used like regular integer
 *                  vector<MInt> dp(10, Mint(0)); // creater a vector with values initialized to 0
 *                  cout << m * 1'000'000'000'000 << endl; // will not overflow
 */

template <int MOD = 1'000'000'007>
struct Modular {
    int value;

    Modular(long long v = 0) {
        value = v % MOD;
        if (value < 0) value += MOD;
    }
    Modular(long long a, long long b) : value(0) {
        *this += a;
        *this /= b;
    }
    Modular &operator+=(Modular const &b) {
        value += b.value;
        if (value >= MOD) value -= MOD;
        return *this;
    }
    Modular &operator-=(Modular const &b) {
        value -= b.value;
        if (value < 0) value += MOD;
        return *this;
    }
    Modular &operator*=(Modular const &b) {
        value = (long long)value * b.value % MOD;
        return *this;
    }

    friend Modular mexp(Modular a, long long e) {
        Modular res = 1;
        while (e) {
            if (e & 1) res *= a;
            a *= a, e >>= 1;
        }
        return res;
    }
    friend Modular inverse(Modular a) {
        int phi = MOD - 1; // change this for general MOD where a^phi = 1 (mod MOD)
        return mexp(a, phi - 1);
    }

    Modular &operator/=(Modular const &b) { return *this *= inverse(b); }
    friend Modular operator+(Modular a, const Modular b) { return a += b; }
    friend Modular operator-(Modular a, const Modular b) { return a -= b; }
    friend Modular operator-(const Modular a) { return 0 - a; }
    friend Modular operator*(Modular a, const Modular b) { return a *= b; }
    friend Modular operator/(Modular a, const Modular b) { return a /= b; }
    friend std::ostream &operator<<(std::ostream &os, const Modular &a) { return os << a.value; }
    friend std::istream &operator>>(std::istream &is, Modular &a) {
        long long temp;
        is >> temp;
        a = Modular(temp);
        return is;
    }
    friend bool operator==(Modular const &a, Modular const &b) { return a.value == b.value; }
    friend bool operator!=(Modular const &a, Modular const &b) { return a.value != b.value; }
};

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(13), cerr << fixed << setprecision(3);

    int n;
    cin >> n;
    if (n < 3) {
        cout << 0 << el;
        return 0;
    }
    vector<Modular<>> dp(n + 1);
    dp[0] = 1, dp[1] = dp[2] = 0;
    Modular<> cur = 0;
    for (int i = 3; i <= n; ++i) {
        dp[i] = (cur += dp[i - 3]);
    }
    cout << dp[n] << el;

    return 0;
}

Measured memory_bytes: 3656