#include #define show(x) cerr << #x << " = " << x << endl using namespace std; using ll = long long; using pii = pair; using vi = vector; template ostream& operator<<(ostream& os, const vector& v) { os << "sz=" << v.size() << "\n["; for (const auto& p : v) { os << p << ","; } os << "]\n"; return os; } template ostream& operator<<(ostream& os, const pair& p) { os << "(" << p.first << "," << p.second << ")"; return os; } constexpr ll MOD = 1e9 + 7; template constexpr T INF = numeric_limits::max() / 100; class Modulo { public: Modulo(const int n, const ll mod = 1000000007LL) : m_size{n + 1}, m_mod{mod} // mod should be prime { assert(n > 0); m_fact.resize(n + 1); m_inv.resize(n + 1); m_inv_fact.resize(n + 1); m_fact[0] = 1; m_inv[0] = 1; m_inv_fact[0] = 1; m_fact[1] = 1; m_inv[1] = 1; m_inv_fact[1] = 1; for (int i = 2; i <= n; i++) { m_fact[i] = (m_fact[i - 1] * static_cast(i)) % mod; m_inv[i] = ((mod - (mod / static_cast(i))) * m_inv[static_cast(mod) % i]) % mod; m_inv_fact[i] = (m_inv_fact[i - 1] * m_inv[i]) % mod; } } ll factorial(const int n) const { assert(n < m_size); return m_fact[n]; } ll inverse(const int n) const { assert(n < m_size); return m_inv[n]; } ll inverseFactorial(const int n) const { assert(n < m_size); return m_inv_fact[n]; } ll permutation(const int n, const int k) const { assert(n < m_size); assert(k <= n); return (m_fact[n] * m_inv_fact[n - k]) % m_mod; } ll combination(const int n, const int k) const { assert(n < m_size); assert(k <= n); return (((m_fact[n] * m_inv_fact[k]) % m_mod) * m_inv_fact[n - k]) % m_mod; } private: const int m_size; const ll m_mod; vector m_fact; vector m_inv; vector m_inv_fact; }; ll power(const ll p, const ll n) { if (n == 0) { return 1; } if (n % 2 == 1) { return (power(p, n - 1) * p) % MOD; } else { const ll pp = power(p, n / 2); return (pp * pp) % MOD; } } int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; Modulo mod(2 * N, MOD); ll sum = 0; for (ll k = 0; k <= N; k++) { sum += (mod.combination(N, k) * power(k, N - k)) % MOD; sum %= MOD; } cout << sum << endl; return 0; }