#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define loop(i,a,b) for(int i=a;i pii; typedef vector vi; typedef vector vvi; typedef vector vp; typedef vector vvp; typedef vector vs; typedef vector vd; typedef vector vvd; typedef pair pip; typedef vectorvip; const double PI=acos(-1); const double EPS=1e-7; const int inf=1e8; const ll INF=1e16; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; #define MOD 1000000007 // a^b mod MOD ll powmod(ll a,ll b){ ll out=1; ll p=a%MOD; while(b){ if(b&1)out=out*p%MOD; p=p*p%MOD; b>>=1; } return out; } #define M 100010 vector fact; void init(){ fact=vector(M); fact[0]=fact[1]=1; loop(i,2,M)fact[i]=fact[i-1]*i%MOD; } // nCr ll nCr(ll n,ll r){ ll out=fact[n]*powmod(fact[r]*fact[n-r]%MOD,MOD-2)%MOD; return out; } int main(){ init(); int n; cin>>n; assert(1<=n&&n<=100000); int out=0; loop(i,1,n+1)(out+=nCr(n,i)*powmod(i,n-i)%MOD)%=MOD; cout<