MOD = 10**9 + 7 def matrix_mult(a, b): return [[(a[0][0]*b[0][0] + a[0][1]*b[1][0]) % MOD, (a[0][0]*b[0][1] + a[0][1]*b[1][1]) % MOD], [(a[1][0]*b[0][0] + a[1][1]*b[1][0]) % MOD, (a[1][0]*b[0][1] + a[1][1]*b[1][1]) % MOD]] def matrix_pow(matrix, power): result = [[1, 0], [0, 1]] # Identity matrix while power > 0: if power % 2 == 1: result = matrix_mult(result, matrix) matrix = matrix_mult(matrix, matrix) power //= 2 return result def fib(n): if n == 0: return 0 # F(n) using matrix exponentiation matrix = [[1, 1], [1, 0]] powered = matrix_pow(matrix, n-1) return powered[0][0] n = int(input()) if n % 2 == 0: k = n // 2 print(fib(k + 1) % MOD) else: k = (n - 1) // 2 # For odd n, the pattern is different. This part is a placeholder and may need adjustment. # The code here is a guess based on even cases and may not work for all odd n. print(fib(k + 2) % MOD)