#include using namespace std; typedef long long ll; const ll mod = 1e9+7; template struct Combination{ T mpow(T x,T n){ T res = 1; while(n != 0){ if(n&1) res = res*x % mod; x = x*x % mod; n = n >> 1; } return res; } vector fac,ifac; constexpr Combination(int max_N) noexcept : fac(max_N,1),ifac(max_N,1){ fac[0] = 1; ifac[0] = 1; for(int i = 0;i < max_N;i ++){ fac[i+1] = fac[i]*(i+1) % mod; ifac[i+1] = ifac[i]*mpow(i+1,mod-2) % mod; } } constexpr T comb(T a,T b){ if(a==0 && b==0) return 1; if(a struct Stirling{ vector > S; constexpr Stirling(int MAX) noexcept : S(MAX+1, vector(MAX+1, 0)) { S[0][0] = 1; for (int n = 1; n <= MAX; ++n) { for (ll k = 1; k <= n; ++k) { S[n][k] = (S[n-1][k-1] + S[n-1][k] * k)%mod; } } } constexpr T stir(int n, int k) { if (n < 0 || k < 0 || n < k) return 0; return S[n][k]; } }; int main(){ int n; ll ans=0; cin >> n; Stirling s(555); Combination c(555); for(int i = 1;i <= n;i ++){ for(int x = i;x <= n;x ++){ ans = (ans + (c.comb(n,x)%mod)*(s.stir(x,i)%mod)*(c.mpow(i*(i-1),n-x)%mod))%mod; } } cout << ans << endl; return 0; }