//
//
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define gc getchar_unlocked
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x) cout < < < < x << endl
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define sz(a) int((a).size())
#define inp(arr, n)                                                                                                                                            \
    for (i = 0; i < n; i++)                                                                                                                                    \
        cin >> arr[i];
#define cum(arr, n, cumm)                                                                                                                                      \
    cumm[0] = 0;                                                                                                                                               \
    for (int i = 0; i < n; i++)                                                                                                                                \
        cumm[i + 1] = cumm[i] + arr[i];

#define fori(a, b, c) for (a = b; a <= c; a++)
#define ford(a, b, c) for (a = b; a >= c; a--)
#define fo(i, n) fori(i, 0, n)
#define rep1(i, n) fori(i, 1, n - 1)
#define disp(arr)                                                                                                                                              \
    for (auto i : arr)                                                                                                                                         \
        cout << i << " ";                                                                                                                                      \
    cout << "\n"
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define nl endl

#define PI 3.1415926535897932384626
#define small 1e-9
#define big5 1000000005
#define big7 1000000007
#define big 1000000

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
const int mod = 1000000007;

bool isPrime(ll n) {
    if (n % 2 == 0)
        return false;
    for (ll i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0)
            return false;
    }
    return true;
}

ll SD(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)
            return i;
    }
    return n;
}

ll lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

// Returns nCr % p.  In this Lucas Theorem based program,
// this function is only called for n < p and r < p.
int nCrModpDP(int n, int r, int p) {
    // The array C is going to store last row of
    // pascal triangle at the end. And last entry
    // of last row is nCr
    int C[r + 1];
    memset(C, 0, sizeof(C));

    C[0] = 1;  // Top row of Pascal Triangle

    // One by constructs remaining rows of Pascal
    // Triangle from top to bottom
    for (int i = 1; i <= n; i++) {
        // Fill entries of current row using previous
        // row values
        for (int j = min(i, r); j > 0; j--)

            // nCj = (n-1)Cj + (n-1)C(j-1);
            C[j] = (C[j] + C[j - 1]) % p;
    }
    return C[r];
}

// Lucas Theorem based function that returns nCr % p
// This function works like decimal to binary conversion
// recursive function.  First we compute last digits of
// n and r in base p, then recur for remaining digits
int nCrModpLucas(int n, int r, int p) {
    // Base case
    if (r == 0)
        return 1;

    // Compute last digits of n and r in base p
    int ni = n % p, ri = r % p;

    // Compute result for last digits computed above, and
    // for remaining digits.  Multiply the two results and
    // compute the result of multiplication in modulo p.
    return (nCrModpLucas(n / p, r / p, p) *  // Last digits of n and r
               nCrModpDP(ni, ri, p)) %
           p;  // Remaining digits
}

void solve() {
    ll n = 1, i = 0, j = 0, k = 0;
    int s;
    cin >> s;
    while (s >= 3 * n) {
        k += nCrModpLucas(s - 2 * n - 1, n - 1, mod);
        k = k % mod;
        n++;
    }
    cout << (k % mod);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);



    ll t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }


    return 0;
}

Measured memory_bytes: 3692