def mat_mul(A, B): C = [[0]*len(B[0]) for _ in range(len(A))] for i in range(len(A)): for j in range(len(B[0])): for k in range(len(A[0])): C[i][j] += A[i][k]*B[k][j] C[i][j] %= MOD return C def mat_pow(A, n): res = [[0]*len(A) for _ in range(len(A))] for i in range(len(A)): res[i][i] = 1 while n>0: if n&1: res = mat_mul(res, A) n >>= 1 A = mat_mul(A, A) return res N = int(input()) MOD = 10**9+7 x = [[1], [0], [0], [0], [0], [0]] A = [[0]*6 for _ in range(6)] for i in range(6): A[0][i] = pow(6, MOD-2, MOD) for i in range(1, 6): A[i][i-1] = 1 res = mat_mul(mat_pow(A, N), x) print(res[0][0])