N = int(input()) mod = int(1e9) + 7 maxf = 0 # <-- input factional limitation def doubling(n, m): y = 1 base = n tmp = m while tmp != 0: if tmp % 2 == 1: y *= base y %= mod base *= base base %= mod tmp //= 2 return y def inved(a): x, y, u, v, k, l = 1, 0, 0, 1, a, mod while l != 0: x, y, u, v = u, v, x - u * (k // l), y - v * (k // l) k, l = l, k % l return x % mod fact = [1 for _ in range(maxf+1)] invf = [1 for _ in range(maxf+1)] for i in range(maxf): fact[i+1] = (fact[i] * (i+1)) % mod invf[-1] = inved(fact[-1]) for i in range(maxf, 0, -1): invf[i-1] = (invf[i] * i) % mod vec1 = [0, 1] vec2 = [2, 1] tmp = N mat = [[1, 0], [0, 1]] bas = [[0, 1], [1, 1]] while tmp != 0: y = [[0, 0], [0, 0]] if tmp % 2 == 1: for i in range(2): for j in range(2): for k in range(2): y[i][j] += mat[i][k] * bas[k][j] % mod y[i][j] %= mod for i in range(2): for j in range(2): mat[i][j] = y[i][j] for i in range(2): for j in range(2): y[i][j] = 0 for i in range(2): for j in range(2): for k in range(2): y[i][j] += bas[i][k] * bas[k][j] % mod y[i][j] %= mod for i in range(2): for j in range(2): bas[i][j] = y[i][j] tmp //= 2 vec1[0], vec1[1] = (mat[0][0] * vec1[0] + mat[0][1] * vec1[1]) % mod, (mat[1][0] * vec1[0] + mat[1][1] * vec1[1]) % mod vec2[0], vec2[1] = (mat[0][0] * vec2[0] + mat[0][1] * vec2[1]) % mod, (mat[1][0] * vec2[0] + mat[1][1] * vec2[1]) % mod print((vec1[0] * vec1[0] + vec1[0] * vec2[0]) * inved(2) % mod)