#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

template<int mod>
class ModInt{
	llong x;
	
public:
	/*constructor.*/
	ModInt(llong x_=0LL):x((x_%mod+mod)%mod){}
	ModInt(const ModInt &a):x(a.x){}
	
	ModInt operator-() const{return ModInt(-x);}
	bool operator==(const ModInt &a) const{return x==a.x;}
	bool operator!=(const ModInt &a) const{return x!=a.x;}
	bool operator<(const ModInt &a) const{return x<a.x;}
	bool operator>(const ModInt &a) const{return x>a.x;}
	bool operator<=(const ModInt &a) const{return x<=a.x;}
	bool operator>=(const ModInt &a) const{return x>=a.x;}
	ModInt& operator++(){return *this+=ModInt(1LL);}
	ModInt& operator--(){return *this-=ModInt(1LL);}
	ModInt& operator+=(const ModInt &a){
		x=(x+a.x)%mod;
		return *this;
	}
	ModInt& operator-=(const ModInt &a){
		x=(x+mod-a.x)%mod;
		return *this;
	}
	ModInt& operator*=(const ModInt &a){
		x=x*a.x%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &a){return (*this)*=a.inv();}
	ModInt operator+(const ModInt &a) const{return ModInt(*this)+=a;}
	ModInt operator-(const ModInt &a) const{return ModInt(*this)-=a;}
	ModInt operator*(const ModInt &a) const{return ModInt(*this)*=a;}
	ModInt operator/(const ModInt &a) const{return ModInt(*this)/=a;}
	ModInt inv() const{return pow(mod-2);}
	ModInt pow(llong k) const{
		ModInt res=1LL, tmp=(*this);
		while(k>0){
			if(k&1) res*=tmp;
			tmp*=tmp, k>>=1;
		}
		return res;
	}
	
	friend ostream& operator<<(ostream &os,const ModInt &m){return os<<m.x;}
	friend istream& operator>>(istream &is,ModInt &a){
		llong x_;
		is>>x_;
		a=x_;
		return is;
	}
};
using mint = ModInt<MOD>;

/*Kitamasa法
a[n]=d[0]*a[n-k]+d[1]*a[n-(k-1)]+....+d[k-1]*a[n-1]
というk項間漸化式のn項目を求める. O((K^2)*log N).*/
template<typename Type>
class Kitamasa{
	const int k;			//k:=(漸化式の階数).
	const vector<Type> a,d;	//a:=(初項ベクトルA), d:=(係数ベクトルD).
	
	vector<Type> add(const vector<Type> &x) const{//f(n)->f(n+1).
		vector<Type> res(k);
		res[0]=x[k-1]*d[0];
		for(int i=1;i<k;++i) res[i]=x[i-1]+x[k-1]*d[i];
		return res;
	}
	vector<Type> mul(const vector<Type> &x) const{//f(n)->f(2*n).
		vector<Type> res(k,0);
		vector<Type> tmp=x;
		REP(i,k){
			REP(j,k) res[j]+=x[i]*tmp[j];
			if(i<k-1) tmp=add(tmp);
		}
		return res;
	}
	template<typename U>
	vector<Type> calc(U n) const{//f(n)を返す.
		vector<Type> res;
		if(n==0){
			res.assign(k,0);
			res[0]=1;
			return res;//f(0).
		}
		res=mul(calc(n/2));
		if(n&1) res=add(res);
		return res;
	}
	
public:
	/*constructor.*/
	Kitamasa(vector<Type> a_,vector<Type> d_):k((int)a_.size()),a(a_),d(d_){
		assert(a.size()==d.size());
	}
	
	template<typename U>
	Type operator [](U n) const{//a[n]を返す.
		vector<Type> x=calc(n);//f(n).
		Type res=0;
		REP(i,k) res+=x[i]*a[i];
		return res;
	}
};

int main(){//Refering other editorials.
	int s;
	cin>>s;
	
	vector<mint> a({1,0,0});
	vector<mint> d({1,0,1});
	Kitamasa<mint> ob(a,d);
	
	cout<<ob[s]<<endl;
	return 0;
}

Measured memory_bytes: 3584