#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long #define fi first #define se second using namespace std; typedef pair P; // typedef double number; typedef int number; const number eps = 1e-8; typedef vector ARRAY; const int mod0 = 1e9 + 7; typedef vector matrix; // O( n ) matrix identity(int n) { matrix A(n, ARRAY(n)); for (int i = 0; i < n; ++i) A[i][i] = 1; return A; } // O( n ) number inner_product(const ARRAY &a, const ARRAY &b) { number ans = 0; for (int i = 0; i < a.size(); ++i) ans += a[i] * b[i]; return ans; } // O( n^2 ) ARRAY mul(const matrix &A, const ARRAY &x) { ARRAY y(A.size()); for (int i = 0; i < A.size(); ++i) for (int j = 0; j < A[0].size(); ++j) y[i] = A[i][j] * x[j]; return y; } // O( n^3 ) matrix mul(const matrix &A, const matrix &B, const int mod) { matrix C(A.size(), ARRAY(B[0].size())); for (int i = 0; i < C.size(); ++i) for (int j = 0; j < C[i].size(); ++j) for (int k = 0; k < A[i].size(); ++k){ C[i][j] += (A[i][k] * B[k][j] % mod); C[i][j] %= mod; } return C; } // O( n^3 log e ) matrix pow(const matrix &A, int e, const int mod) { return e == 0 ? identity(A.size()) : e % 2 == 0 ? pow(mul(A, A, mod), e/2, mod) : mul(A, pow(A, e-1, mod), mod); } signed main(){ int n; cin >> n; vector > A(2, vector(2, 0)); A[0][0] = A[0][1] = A[1][0] = 1; A[1][1] = 0; vector > B = A; int mod1 = 2 * mod0 + 2; B = pow(A, n, mod1); B[1][0] = (B[1][0] + mod1) % mod1; cout << B[1][0] << endl; // A = pow(A, B[1][0], mod0); cout << A[1][0] << endl; }