p = 10**9 + 7 #10**9 + 7 ''' a, b = 1, 0 i = 0 while(True): a, b = (a + b) % p, a i += 1 if (i % 10000 == 0):print(i) if (a == 1 and b == 0):break if (a == 0 and b == 0):break print(i, a, b) ''' # fib(cycle)%p = 0 # fib(cycle + 1)%p = 1 cycle = 2000000016 def fib(n, mod): a, b, d = 1, 1, 0 ta, tb, tc, td = 1, 0, 0, 1 while n: if n & 1: ta, tb, tc, td = (a*ta+b*tb)%mod, (a*tb+b*td)%mod, (b*ta+d*tc)%mod, (b*tb+d*td)%mod a, b, d = (a*a+b*b)%mod, (b*(a+d))%mod, (b*b+d*d)%mod n >>= 1 return tc n = int(input()) x = fib(n, cycle) y = fib(x, p) print(y)