#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; typedef vector vec; typedef vector mat; const ll MOD = 1000000007; mat mul(mat &A, mat &B, ll mod){ mat C(A.size(), vec(B[0].size())); rep(i,A.size()) rep(k,B.size()){ rep(j,B[0].size()){ C[i][j] = (C[i][j]+A[i][k]*B[k][j])%mod; } } return C; } mat pow(mat A, ll n, ll mod){ mat B(A.size(), vec(A.size())); rep(i,A.size()) B[i][i] = 1; while(n>0){ if(n&1LL) B=mul(B,A,mod); A=mul(A,A,mod); n>>=1; } return B; } int main(){ ll N; cin >> N; mat a(2,vec(2,0)); a[0][0] = 1; a[0][1] = 1; a[1][0] = 1; a[1][1] = 0; mat b = pow(a, N, MOD+1); ll m = b[0][1]; //cout << b[0][0] << " " << b[0][1] << endl; //cout << b[1][0] << " " << b[1][1] << endl; if(m==0) m = MOD+1; mat c = pow(a, m, MOD); //cout << c[0][0] << " " << c[0][1] << endl; //cout << c[1][0] << " " << c[1][1] << endl; cout << c[0][1] << endl; return 0; }