import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) ### 行列積 matrix multiplication ### 繰り返し2乗法 kurikae def mul(a,b): """行列a,bの積 aかbがNone のとき、単位行列として扱う """ if a is None: return b elif b is None: return a n,m = len(a), len(a[0]) k,l = len(b), len(b[0]) # k==m out = [[0]*l for _ in range(n)] for i in range(n): for j in range(l): for p in range(m): out[i][j] += a[i][p]*b[p][j]%M if out[i][j]>M: out[i][j] -= M return out def mul2(m,a): """行列と配列の積 m : None のとき単位行列扱い """ if m is None: return a k,l = len(m), len(m[0]) # ll = len(a) ans = [0]*k for i in range(k): for j in range(l): ans[i] += m[i][j] * a[j] % M if ans[i]>M: ans[i] -= M return ans def mulk(m, k): """a^kを求める """ if k==0: return None ans = None tmp = m while k>0: if k&1: ans = mul(ans, tmp) tmp = mul(tmp, tmp) k = k>>1 return ans n = int(input()) M = 10**9+7 inv = pow(6, M-2, M) a = [[0]*6 for _ in range(6)] for i in range(6): a[0][i] = inv for j in range(6): if i>0 and j+1==i: a[i][j] = 1 b = mulk(a, n) res = mul2(b, [1]+[0]*5) ans = res[0] print(ans%M)