#include using namespace std; #define ll long long int long long int MOD; vector > mul(vector > a, vector> b) { vector >c(2, vector(2)); c[0][0] = 0; c[0][1] = 0; c[1][0] = 0; c[1][1] = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { c[i][j] += (a[i][k] * b[k][j]); c[i][j] %= MOD; } } } return c; } int main(void) { vector > a(2, vector(2)); vector > b(2, vector(2)); long long int n; a[0][0] = 1; a[0][1] = 1; a[1][0] = 1; a[1][1] = 0; b[0][0] = 1; b[0][1] = 0; b[1][0] = 0; b[1][1] = 1; MOD = 2e9 + 16; cin >> n; while (n > 0) { if (n & 1) { b = mul(a, b); } a = mul(a, a); n >>= 1; } n = b[1][0]; MOD = 1e9 + 7; a[0][0] = 1; a[0][1] = 1; a[1][0] = 1; a[1][1] = 0; b[0][0] = 1; b[0][1] = 0; b[1][0] = 0; b[1][1] = 1; while (n > 0) { if (n & 1) { b = mul(a, b); } a = mul(a, a); n >>= 1; } cout << b[1][0] << '\n'; return 0; }