import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 def convolve(f, g, MOD=MOD): Lf = len(f) Lg = len(g) fl = f & (1 << 15) - 1 fh = f >> 15 gl = g & (1 << 15) - 1 gh = g >> 15 def conv(f, g): return np.convolve(f, g) % MOD x = conv(fl, gl) y = conv(fl + fh, gl + gh) z = conv(fh, gh) a, b, c = map(lambda x: (x + .5).astype(np.int64), [x, y, z]) return (a + ((b - a - c) << 15) + (c << 30)) % MOD def coef_of_generating_function(P, Q, N): """compute the coefficient [x^N] P/Q of rational power series. Parameters ---------- P : np.ndarray numerator. Q : np.ndarray denominator Q[0] == 1 and len(Q) == len(P) + 1 is assumed. N : int The coefficient to compute. """ def conv(f, g): return convolve(f, g, MOD) while N: Q1 = Q.copy() Q1[1::2] = np.negative(Q1[1::2]) if N & 1: P = conv(P, Q1)[1::2] else: P = conv(P, Q1)[::2] Q = conv(Q, Q1)[::2] N >>= 1 return P[0] N = int(read()) t = -pow(6, MOD - 2, MOD) num = np.array([1, 0, 0, 0, 0, 0], np.int64) den = np.array([1, t, t, t, t, t, t], np.int64) print(coef_of_generating_function(num, den, N))