def polymul(f,g): lf = len(f) lg = len(g) res = [0]*(lf+lg-1) for i in range(lf): for j in range(lg): res[i+j] += f[i]*g[j] res[i+j] %= MOD return res def fps_nth_term(f,g,N): assert g[0] != 0 while N: h = g[:] for i in range(1,len(g),2): h[i] = -h[i] f = polymul(f,h)[N%2:N+1:2] g = polymul(g,h)[:N+1:2] N //= 2 return f[0]*pow(g[0],MOD-2,MOD)%MOD n = int(input()) MOD = 10**9+7 print(fps_nth_term([1, 9, 32, 12, 999999971, 16], [1, 1000000004, 3, 1000000006, 0, 0, 0],n))