#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long fac[100010], finv[100010], inv[100010]; long long mod = 1000000007; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < 100010; i++) { fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod % i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } long long COM(long long n, long long k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % mod) % mod; } int main() { COMinit(); long long n; cin >> n; long long ans = 0; for (long long i = 0; i < n; i++) { long long x = n - i; long long y = i; long long ans1 = 1; while (y > 0) { if ((y & 1) == 1) { ans1 = ans1 * x % mod; } x = x * x % mod; y >>= 1; } ans += COM(n, i) * ans1 % mod; ans %= mod; } cout << ans << endl; }