mod = int(1e9) + 7 maxf = int(1e5) # <-- input factional limitation def doubling(n, m): y = 1 base = n tmp = m while tmp != 0: if tmp % 2 == 1: y *= base y %= mod base *= base base %= mod tmp //= 2 return y def inved(a): x, y, u, v, k, l = 1, 0, 0, 1, a, mod while l != 0: x, y, u, v = u, v, x - u * (k // l), y - v * (k // l) k, l = l, k % l return x % mod fact = [1 for _ in range(maxf+1)] invf = [1 for _ in range(maxf+1)] for i in range(maxf): fact[i+1] = (fact[i] * (i+1)) % mod invf[-1] = inved(fact[-1]) for i in range(maxf, 0, -1): invf[i-1] = (invf[i] * i) % mod N = int(input()) S = 0 sgn = mod - 1 for i in range(1, N+1): S += ((invf[i] * invf[N-i]) % mod) * doubling(i, N - i) % mod S %= mod S *= fact[N] S %= mod print(S)