#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <list>
#include <numeric>
#include <math.h>
#include <cstdlib>
#include <queue>
#include <iterator>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <stack>
#include <memory>
#include <deque>
#include <string_view>
#include <random>
#include <chrono>
#include <cstring>

using namespace std;

static int my_speed_up = []() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }();
using ll = long long; using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T> using vv = vector<vector<T>>;
template<class T> using vvv = vector<vector<vector<T>>>;
template<class T> using vvvv = vector<vector<vector<vector<T>>>>;
template<class T1, class T2> using um = unordered_map<T1, T2>;
template<class T> using us = unordered_set<T>;
using pii = pair<int,int>;
#define print_line cout << "[" << setw(3) << __LINE__ << "]  ";
#define for_b(i, b) for (int i = 0; i < (b); ++i)
#define for_ab(i, a, b) for (int i = a; i < (b); ++i)
#define what_is(x) { print_line cout << #x << " = " << x << endl; }
template<class T, class ... Ts> void what_are_2(T const& arg, Ts const&...args) { cout << arg; if constexpr (sizeof...(args) > 0) { cout << ", "; what_are_2(args...); } }
#define what_are(...) { print_line what_are_2(__VA_ARGS__); cout << endl; }
#define hit { print_line cout << "hit!" << endl; }
#define pad(x) for_b(i, x) cout << "  ";
#define show_1d(___x) { print_line cout << #___x << " = "; for (auto ___num : ___x) cout << ___num << ", "; cout << endl;} 
#define show_2d(___x) { print_line cout << #___x << endl; for (auto ___row : ___x) { for (auto ___num : ___row) cout << ___num << ", "; cout << endl; }}
#define show_3d(___x) { print_line cout << #___x << endl; for (auto ___row : ___x) { for (auto ___row2 : ___row) { for (auto ___num : ___row2) cout << ___num << ", "; cout << endl; }cout << endl; }}

vv<int> d4 = {{1,0},{-1,0},{0,1},{0,-1}};
vv<int> d8 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
bool is_valid_pos(size_t w, size_t h, int x, int y) {
    return x >= 0 && x < static_cast<int>(w) && y >= 0 && y < static_cast<int>(h);
}

// ⣿⣿⣟⣽⣿⣿⣿⣿⣟⣵⣿⣿⣿⡿⣳⣫⣾⣿⣿⠟⠻⣿⣿⣿⢻⣿⣿⣿⣿⣷⡽⣿
// ⣿⣟⣾⡿⣿⣿⢟⣽⣿⣿⣿⣿⣫⡾⣵⣿⣿⣿⠃⠄⠄⠘⢿⣿⣾⣿⣿⣿⢿⣿⣿⡜
// ⡿⣼⡟⣾⣿⢫⣿⣿⣿⣿⡿⣳⣿⣱⣿⣿⣿⡋⠄⠄⠄⠄⠄⠛⠛⠋⠁⠄⠄⣿⢸⣿
// ⢳⣟⣼⡿⣳⣿⣿⣿⣿⡿⣹⡿⣃⣿⣿⣿⢳⠁⠄⠄⠄⢀⣀⠄⠄⠄⠄⠄⢀⣿⢿⣿
// ⡟⣼⣿⣱⣿⡿⣿⣿⣿⢡⣫⣾⢸⢿⣿⡟⣿⣶⡶⢰⣿⣿⣿⢷⠄⠄⠄⠄⢼⣿⣸⣿
// ⣽⣿⢣⣿⡟⣽⣿⣿⠃⣲⣿⣿⣸⣷⡻⡇⣿⣿⢇⣿⣿⣿⣏⣎⣸⣦⣠⡞⣾⢧⣿⣿
// ⣿⡏⣿⡿⢰⣿⣿⡏⣼⣿⣿⡏⠙⣿⣿⣤⡿⣿⢸⣿⣿⢟⡞⣰⣿⣿⡟⣹⢯⣿⣿⣿
// ⡿⢹⣿⠇⣿⣿⣿⣸⣿⣿⣿⣿⣦⡈⠻⣿⣿⣮⣿⣿⣯⣏⣼⣿⠿⠏⣰⡅⢸⣿⣿⣿
// ⡀⣼⣿⢰⣿⣿⣇⣿⣿⡿⠛⠛⠛⠛⠄⣘⣿⣿⣿⣿⣿⣿⣶⣿⠿⠛⢾⡇⢸⣿⣿⣿
// ⠄⣿⡟⢸⣿⣿⢻⣿⣿⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡋⠉⣠⣴⣾⣿⡇⣸⣿⣿⡏
// ⠄⣿⡇⢸⣿⣿⢸⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠘⢿⣿⠏⠄⣿⣿⣿⣹
// ⠄⢻⡇⢸⣿⣿⠸⣿⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣦⣼⠃⠄⢰⣿⣿⢯⣿
// ⠄⢸⣿⢸⣿⣿⡄⠙⢿⣿⣿⡿⠁⠄⠄⠄⠄⠉⣿⣿⣿⣿⣿⣿⡏⠄⢀⣾⣿⢯⣿⣿
// ⣾⣸⣿⠄⣿⣿⡇⠄⠄⠙⢿⣀⠄⠄⠄⠄⠄⣰⣿⣿⣿⣿⣿⠟⠄⠄⣼⡿⢫⣻⣿⣿
// ⣿⣿⣿⠄⢸⣿⣿⠄⠄⠄⠄⠙⠿⣷⣶⣤⣴⣿⠿⠿⠛⠉⠄⠄ ⢸⣿⣿⣿⣿⠃⠄⢀⣴


vv<ull> generate_pascal_tb(int size, ull mod)
{
    vv<ull> res (size, v<ull>(size, 0));
    for_b(i,res.size())
    {
        res[i][0] = 1;
        for_b(j,i)
            res[i][j+1] = (res[i-1][j+1] + res[i-1][j]) % mod;
    }
    return res;
}




int main()
{
    ull mod = 1e9 + 7;
    
    ull S;
    cin >> S;
    
    if (S < 3)
    {
        cout << 0 << endl;
        return 0;
    }
    
    ull max_split = S / 3;
    auto tb = generate_pascal_tb(S, mod);
    
    ull res = 0;
    for (ull i = 1 ; i <= max_split ; ++i)
    {
        ull remain = S - i * 3;
        res += tb[remain+(i-1)][(i-1)];
        res %= mod;
    }
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 34604