import java.io.*;
import java.util.*;
import java.math.*;
class Nth_Fibonacci {
static class Matrix {
/*data member*/
public long[][] matrix;
/*Constructor*/
public Matrix(int n) {
matrix=new long[n][n];
}
/**
* @param other Matrix
* @param mod
*
* this method performs matrix multiplication of this.matrix
* and other.matrix and returns the product matrix
* */
public Matrix multiply(Matrix other,int mod) {
Matrix product = new Matrix(matrix.length);
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix.length; j++) {
for (int k = 0; k < matrix.length; k++) {
product.matrix[i][k] = (product.matrix[i][k] + matrix[i][j] * other.matrix[j][k])%mod;
}
}
}
return product;
}
}
/*binary exponentiation using matrices*/
public static Matrix exponentiation
(Matrix m,
biginteger n,
int mod
) {
Matrix expo = new Matrix(m.matrix.length);
for (int i = 0; i < m.matrix.length; i++) expo.matrix[i][i]=1;
if(n.
remainder(biginteger.
valueOf(2)).
compareTo(biginteger.
valueOf(1)) ==
0) expo = expo.
multiply(m,mod
);
m = m.multiply(m,mod);
}
return expo;
}
/*for taking input.*/
/*because of constraints ,I read the number in string since it does not fit in long as well.*/
string s = br.
readLine().
trim();
/*convert the string to bigInteger to be able to perform some arithmetic operations*/
int mod = (int)1e9+7;
Matrix A = new Matrix(2);
A.matrix[0][0] = 0;
A.matrix[0][1] = A.matrix[1][0] = A.matrix[1][1] = 1;
Matrix ans = exponentiation(A,n,mod);
int result = (int)(ans.matrix[0][1] % mod) ;
system.
out.
println(n +
"-th Fibonacci number is : " + result
);
}
}