def mt(A, B): C = [[0] * 6 for _ in range(6)] for i in range(6): for j in range(6): tmp = 0 for k in range(6): tmp += A[i][k] * B[k][j] tmp %= MOD C[i][j] = tmp return C MOD = 10 ** 9 + 7 N = int(input()) A = [[0] * 6 for _ in range(6)] X = [[0] * 6 for _ in range(6)] for i in range(6): A[0][i] = pow(6, -1, MOD) X[i][i] = 1 for i in range(5): A[i + 1][i] = 1 while N > 0: if N & 1: X = mt(A, X) A = mt(A, A) N >>= 1 print(X[0][0])