#if loc||local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<int64_t MOD>
struct mod_int{
  int64_t val;
  constexpr mod_int():val(0){}
  constexpr mod_int(int64_t x)noexcept:val(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD){}
  constexpr int64_t value()const noexcept{return val;}
  constexpr int64_t get_MOD()const noexcept{return MOD;}
  constexpr mod_int operator+(mod_int const& rhs){
    return mod_int(*this)+=rhs;
  }
  constexpr mod_int operator-(mod_int const& rhs){
    return mod_int(*this)-=rhs;
  }
  constexpr mod_int operator*(mod_int const& rhs){
    return mod_int(*this)*=rhs;
  }
  constexpr mod_int operator/(mod_int const& rhs){
    return mod_int(*this)/=rhs;
  }
  constexpr mod_int &operator+=(mod_int const& rhs)noexcept{
    val += rhs.val;
    if(val>=MOD)val-=MOD;
    return *this;
  }
  constexpr mod_int &operator-=(mod_int const& rhs)noexcept{
    if(val<rhs.val)val+=MOD;
    val-=rhs.val;
    return *this;
  }
  constexpr mod_int &operator*=(mod_int const& rhs)noexcept{
    (val*=rhs.val)%=MOD;
    return *this;
  }
  constexpr mod_int &operator/=(mod_int rhs)noexcept{
    *this*=rhs.inverse();
    return *this;
  }
  constexpr mod_int &operator++(int _){val += 1;if(val>MOD)val-=MOD;return *this;}
  constexpr mod_int &operator++(){val += 1;if(val>MOD)val-=MOD;return *this;}
  constexpr mod_int &operator--(int _){val -= 1;if(val<0)val+=MOD;return *this;}
  constexpr mod_int &operator--(){val -= 1;if(val<0)val+=MOD;return *this;}
  constexpr bool operator==(mod_int const& rhs)const{
    return val==rhs.val;
  }
  constexpr bool operator!=(mod_int const& rhs)const{
    return !(val==rhs.val);
  }
  constexpr bool operator<(mod_int const& rhs)const{
    return val<rhs.val;
  }
  constexpr bool operator>(mod_int const& rhs)const{
    return val>rhs.val;
  }
  constexpr bool operator<=(mod_int const& rhs)const{
    return !(val>rhs.val);
  }
  constexpr bool operator>=(mod_int const& rhs)const{
    return !(val<rhs.val);
  }
  constexpr friend std::ostream &operator<<(std::ostream& os, mod_int const& mi){
    return os<<mi.val;
  }
  constexpr friend std::istream &operator>>(std::istream& is, mod_int & mi){
    int64_t t=0;is>>t;
    mi = mod_int<MOD>(t);
    return is;
  }
  constexpr mod_int inverse(){
    int64_t a=val,b=MOD,u=1,v=0,t=0;
    while(b>0){
      t=a/b;
      std::swap(a-=t*b,b);
      std::swap(u-=t*v,v);
    }
    return mod_int(u);
  }
  constexpr mod_int mpow(int64_t n)const{
    mod_int res(1),e(*this);
    while(n){
      if(n&1)res*=e;
      e*=e;
      n>>=1;
    }
    return res;
  }
};
using mint = mod_int<1000000007>;
mint mpow(int64_t p,int64_t n){
  mint res=1;
  mint e = p;
  while(n){
    if(n&1)res*=e;
    e*=e;
    n>>=1;
  }
  return res;
}

struct combination{
  using i64 = int64_t;
  static constexpr i64 COM_MAX = 2e6;
  static constexpr i64 MOD = 1e9+7;
  vector<i64> fac,inv,finv;
  combination(){
    fac.resize(COM_MAX);
    inv.resize(COM_MAX);
    finv.resize(COM_MAX);
    fac[0] = fac[1] = 1;
    inv[1] = 1;
    finv[0] = finv[1] = 1;
    for(int i=2;i<COM_MAX;++i){
      fac[i]=fac[i-1]*i%MOD;
      inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
      finv[i]=finv[i-1]*inv[i]%MOD;
    }
  }
  template<class T>
  mint nCk(T n,T k){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    if(n>=COM_MAX){
      mint res1 = mint(1);
      mint res2 = mint(fac[k]);
      for(int i=1;i<=k;++i){
        res1 *= n-(i-1);
      }
      return res1/res2;
    }
    return mint(fac[n]*(finv[k]*finv[n-k]%MOD));
  }
  template<class T>
  mint nHk(T n,T k){
    return nCk(n+k-1,k-1);
  }
  template<class T>
  mint operator()(T n,T k){
    return nCk(n,k);
  }
};
template<class T,class F>
struct segment_tree{
  std::vector<T> data;
  int n;F f;T identity;
  segment_tree(){}
  segment_tree(int sz,T ide,F _f):f(_f),identity(ide){
    n=1;while(n<sz)n<<=1;
    data.resize(2*n,identity);
  }
  segment_tree(std::vector<T> const& v,T ide,F _f):f(_f),identity(ide){
    build(v);
  }
  void reset(){for(auto&d:data)d=identity;}
  void build(std::vector<T> const& v){
    int sz=v.size();
    n=1;while(n<sz)n<<=1;
    data.resize(2*n,identity);
    for(int i=0;i<sz;++i)data[i+n]=v[i];
    for(int i=n-1;i>0;--i)data[i]=f(data[i<<1|0],data[i<<1|1]);
  }
  void set(int i,T x){
    i+=n;data[i]=x;
    while(i,i>>=1)data[i]=f(data[i<<1|0],data[i<<1|1]);
  }
  T fold(int l,int r)const{
    l+=n,r+=n;
    T fold_l=identity,fold_r=identity;
    while(l<r){
      if(l&1)fold_l=f(fold_l,data[l++]);
      if(r&1)fold_r=f(data[--r],fold_r);
      l>>=1,r>>=1;
    }
    return f(fold_l,fold_r);
  }
  T operator[](int i)const{return data[i+n];}
  template<class Cond>int bserch(int l,Cond& cond){
    l+=n;T x=identity;
    do{
      while(!l&1)l>>=1;if(cond(f(x,data[l]))){
        while(l<n){l<<=1;if(!cond(f(x,data[l])))x=f(x,data[l++]);}
        return l-n;
      }x=f(x,data[l++]);
    }while((l&-l)!=l);
    return -1;
  }
};
template<class T,class F>
auto make_segtree(int n,T ide,F f){
  return segment_tree<T,F>(n,ide,f);
}
template<class T,class F>
auto make_segtree(std::vector<T>const& v,T ide,F f){
  return segment_tree<T,F>(v,ide,f);
}
signed main(){

  int s;
  cin>>s;

  int n = (s+2)/3;
  auto sum = [](auto a,auto b){return a+b;};
  auto dp = make_segtree<mint>(s+5,mint(0),sum);
  auto nxt_dp = make_segtree<mint>(s+5,mint(0),sum);
  rep(i,n){
    dp.set(0,1);
    for(int j=3;j<=s;++j){
      int s = 0;
      int t = j-3;
      auto tmp = dp.fold(s,t+1);
      nxt_dp.set(j,tmp);
    }
    //for(int i=0;i<=s;++i)cout<<nxt_dp[i]<<" ";cout<<endl;
    dp.data = nxt_dp.data;
    nxt_dp.reset();
  }
  cout<<(dp[s])<<endl;

}


Measured memory_bytes: 3656