#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long int ll; typedef vector VI; typedef vector VL; typedef pair PI; const ll mod = 1e9 + 7; ll powmod(ll a, ll e) { ll sum = 1; ll cur = a; while (e > 0) { if (e % 2) { sum = sum * cur % mod; } cur = cur * cur % mod; e /= 2; } return sum; } const int N = 123456; ll fact[N]; void init(void) { fact[0] = 1; REP(i, 1, N) { fact[i] = fact[i - 1] * i % mod; } } int main(void) { ios::sync_with_stdio(false); cin.tie(0); init(); int n; cin >> n; ll tot = 0; REP(i, 0, n + 1) { ll cur = fact[n]; cur = cur * powmod(fact[i] * fact[n - i] % mod, mod - 2); cur = cur * powmod(i, n - i) % mod; tot = (tot + cur) % mod; } cout << tot << "\n"; }