import sys stdin = sys.stdin def na(): return map(int, stdin.readline().split()) def ns(): return stdin.readline().strip() def fib(n, mod): a = 1 b = 1 d = 0 va = 1 vb = 0 n -= 1 while n > 0: if n % 2 == 1: va, vb = (a*va+b*vb)%mod, (b*va+d*vb)%mod a, b, d = (a*a+b*b)%mod, b*(a+d)%mod, (d*d+b*b)%mod n >>= 1 return va n = int(ns()) mod = 1000000007 xmod = mod*(mod+1)*(mod-1) if n == 0: print(0) else: print(fib(fib(n, xmod), mod))