import numpy as np N = int(input()) mod = 10**9 + 7 cycle = 2000000016 def matrix_power(A, N, mod): # returnA^N %mod in O(K**3 log N). (K is the size of A.) assert A.shape[0] == A.shape[1] K = A.shape[0] if N == 0: return np.eye(K, dtype=np.int64) else: if N % 2 == 0: mat = matrix_power(A, N//2, mod) return np.dot(mat, mat) % mod else: mat = matrix_power(A, N//2, mod) return np.dot(np.dot(mat, mat) % mod, A) % mod def Fibonacci(N, mod): # return the n-th term of the fivonacci sequence in O(logN). # F0=0,F1=1 d = np.array([1, 0]) A = np.array([[1, 1], [1, 0]], dtype=np.int64) res = np.dot(matrix_power(A, N, mod), d) return int(res[-1]) % mod fibN = Fibonacci(N ,cycle) print(Fibonacci(fibN, mod))