#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long int ll; typedef vector VI; typedef vector VL; typedef pair PI; const ll mod = 1e9 + 7; vector mul(const vector &a, const vector &b, ll mod) { int n = a.size(); int m = b.size(); int l = b[0].size(); vector ret(n, VL(l, 0)); REP(i, 0, n) { REP(j, 0, m) { REP(k, 0, l) { ret[i][k] = (ret[i][k] + a[i][j] * b[j][k]) % mod; } } } return ret; } vector pow(const vector &a, ll e, ll mod) { int n = a.size(); vector sum(n, VL(n, 0)); REP(i, 0, n) { sum[i][i] = 1; } vector cur = a; while (e > 0) { if (e % 2) { sum = mul(sum, cur, mod); } cur = mul(cur, cur, mod); e /= 2; } return sum; } ll fib(ll n, ll mod) { vector a(2, VL(2, 1)); a[0][0] = 0; vector ea = pow(a, n, mod); return ea[0][1] % mod; } int main(void){ ll n; cin >> n; ll p = fib(n, mod + 1); cout << fib(p, mod) << endl; }