#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVI; typedef pair P; typedef pair PL; vector mulmat(vector A, vector B, ll mod){ int n = A.size(); vector C(n, VL(n)); REP(i,n) REP(j,n) REP(k,n) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % mod; return C; } vector powmat(vector A, ll x, ll mod){ int n = A.size(); vector B(n, VL(n)); REP(i,n) B[i][i] = 1; while (x){ if (x & 1) B = mulmat(B, A, mod); A = mulmat(A, A, mod); x >>= 1; } return B; } int main() { ll n; cin >> n; vector A(2,VL(2,1)); A[1][1] = 0; A = powmat(A, n, 1e9 + 6); ll fi = A[1][0]; // REP(i,2){ // REP(j,2){ // cout << A[i][j] << " "; // }cout << endl; // } A[0][0] = A[0][1] = A[1][0] = 1; A[1][1] = 0; A = powmat(A, fi, 1e9 + 7); cout << A[1][0] << endl; return 0; }