N=int(raw_input()) comb=[[0 for i in range(556)] for j in range(556)] comb[0][0]=1 mod=1000000007 for i in range(1,556): comb[i][0]=1 for j in range(1,i+1): comb[i][j] = comb[i-1][j]+comb[i-1][j-1] comb[i][j]%=mod ans=1 dp=[[0 for i in range(556)] for j in range(556)] dp[0][0]=1 for i in range(1,N+1): dp[i][1]=1 for j in range(2,i+1): dp[i][j]+=dp[i-1][j]*j dp[i][j]+=dp[i-1][j-1] dp[i][j]%=mod #print i,j,dp[i][j] for i in range(2,N+1): for j in range(2,i+1): #create j groups using i pairs tmp=dp[i][j] tmp%=mod for k in range(N-i): #distribute k pairs separately into j groups tmp*=j*(j-1) tmp%=mod #print i,j,tmp,"*",comb[N][i] ans+=tmp*comb[N][i] ans%=mod print ans