using namespace std;
typedef vector<vector<long long>> matrix;
const long long mod = 1000000007LL;
matrix operator * (const matrix &a, const matrix &b) {
int n = a.size();
matrix c(n, vector<long long>(n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
c[i][j] += a[i][k] * b[k][j];
}
c[i][j] %= mod;
}
}
return c;
}
int main(void)
{
long long n;
cin >> n;
if (n <= 1) {
cout << n << '\n';
return 0;
}
matrix ans = { { 1, 0 },{ 0, 1 } };
matrix a = { { 1, 1 },{ 1, 0 } };
while (n > 0) {
if (n % 2 == 1) {
ans = ans * a;
}
a = a * a;
n /= 2;
}
cout << ans[0][1] << '\n';
return 0;
}
CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIHZlY3Rvcjx2ZWN0b3I8bG9uZyBsb25nPj4gbWF0cml4OwoKY29uc3QgbG9uZyBsb25nIG1vZCA9IDEwMDAwMDAwMDdMTDsKCm1hdHJpeCBvcGVyYXRvciAqIChjb25zdCBtYXRyaXggJmEsIGNvbnN0IG1hdHJpeCAmYikgewoKCWludCBuID0gYS5zaXplKCk7CgoJbWF0cml4IGMobiwgdmVjdG9yPGxvbmcgbG9uZz4obikpOwoKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgoJCWZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKSB7CgoJCQlmb3IgKGludCBrID0gMDsgayA8IG47IGsrKykgewoKCQkJCWNbaV1bal0gKz0gYVtpXVtrXSAqIGJba11bal07CgoJCQl9CgoJCQljW2ldW2pdICU9IG1vZDsKCgkJfQoKCX0KCglyZXR1cm4gYzsKCn0KCgoKCgppbnQgbWFpbih2b2lkKQoKewoKCWxvbmcgbG9uZyBuOwoKCWNpbiA+PiBuOwoKCWlmIChuIDw9IDEpIHsKCgkJY291dCA8PCBuIDw8ICdcbic7CgoJCXJldHVybiAwOwoKCX0KCgltYXRyaXggYW5zID0geyB7IDEsIDAgfSx7IDAsIDEgfSB9OwoKCW1hdHJpeCBhID0geyB7IDEsIDEgfSx7IDEsIDAgfSB9OwoKCgoJd2hpbGUgKG4gPiAwKSB7CgoJCWlmIChuICUgMiA9PSAxKSB7CgoJCQlhbnMgPSBhbnMgKiBhOwoKCQl9CgoJCWEgPSBhICogYTsKCgkJbiAvPSAyOwoKCX0KCgoKCWNvdXQgPDwgYW5zWzBdWzFdIDw8ICdcbic7CgoKCglyZXR1cm4gMDsKCn0=
prog.c:2:1: error: unknown type name ‘using’
using namespace std;
^~~~~
prog.c:2:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘std’
using namespace std;
^~~
prog.c:4:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
typedef vector<vector<long long>> matrix;
^
prog.c:8:1: error: unknown type name ‘matrix’
matrix operator * (const matrix &a, const matrix &b) {
^~~~~~
prog.c:8:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
matrix operator * (const matrix &a, const matrix &b) {
^
prog.c: In function ‘main’:
prog.c:44:2: error: ‘cin’ undeclared (first use in this function)
cin >> n;
^~~
prog.c:44:2: note: each undeclared identifier is reported only once for each function it appears in
prog.c:48:3: error: ‘cout’ undeclared (first use in this function)
cout << n << '\n';
^~~~
prog.c:54:2: error: unknown type name ‘matrix’
matrix ans = { { 1, 0 },{ 0, 1 } };
^~~~~~
prog.c:54:2: warning: braces around scalar initializer
prog.c:54:2: note: (near initialization for ‘ans’)
prog.c:54:22: warning: excess elements in scalar initializer
matrix ans = { { 1, 0 },{ 0, 1 } };
^
prog.c:54:22: note: (near initialization for ‘ans’)
prog.c:54:2: warning: braces around scalar initializer
matrix ans = { { 1, 0 },{ 0, 1 } };
^~~~~~
prog.c:54:2: note: (near initialization for ‘ans’)
prog.c:54:31: warning: excess elements in scalar initializer
matrix ans = { { 1, 0 },{ 0, 1 } };
^
prog.c:54:31: note: (near initialization for ‘ans’)
prog.c:54:26: warning: excess elements in scalar initializer
matrix ans = { { 1, 0 },{ 0, 1 } };
^
prog.c:54:26: note: (near initialization for ‘ans’)
prog.c:56:2: error: unknown type name ‘matrix’
matrix a = { { 1, 1 },{ 1, 0 } };
^~~~~~
prog.c:56:2: warning: braces around scalar initializer
prog.c:56:2: note: (near initialization for ‘a’)
prog.c:56:20: warning: excess elements in scalar initializer
matrix a = { { 1, 1 },{ 1, 0 } };
^
prog.c:56:20: note: (near initialization for ‘a’)
prog.c:56:2: warning: braces around scalar initializer
matrix a = { { 1, 1 },{ 1, 0 } };
^~~~~~
prog.c:56:2: note: (near initialization for ‘a’)
prog.c:56:29: warning: excess elements in scalar initializer
matrix a = { { 1, 1 },{ 1, 0 } };
^
prog.c:56:29: note: (near initialization for ‘a’)
prog.c:56:24: warning: excess elements in scalar initializer
matrix a = { { 1, 1 },{ 1, 0 } };
^
prog.c:56:24: note: (near initialization for ‘a’)
prog.c:76:13: error: subscripted value is neither array nor pointer nor vector
cout << ans[0][1] << '\n';
^