#include #define GET_MACRO(a, b, c, NAME, ...) NAME #define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__) #define rep2(i, a) rep3 (i, 0, a) #define rep3(i, a, b) for (int i = (a); i < (b); i++) #define repr(...) GET_MACRO(__VA_ARGS__, repr3, repr2)(__VA_ARGS__) #define repr2(i, a) repr3 (i, 0, a) #define repr3(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define chmin(a, b) ((b) < a && (a = (b), true)) #define chmax(a, b) (a < (b) && (a = (b), true)) using namespace std; typedef long long ll; const ll mod = 1e9 + 7; ll C[600][600]; ll S[600][600]; ll modpow(ll a, ll b, ll mod) { ll res = 1; while (b) { if (b & 1) (res *= a) %= mod; (a *= a) %= mod; b /= 2; } return res; } int main() { int n; cin >> n; C[0][0] = 1; rep (i, 1, 600) { C[i][0] = 1; rep (j, 1, 600) { C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod; } } rep (i, 1, 600) { S[i][1] = S[i][i] = 1; rep (j, 2, i) { S[i][j] = (S[i - 1][j - 1] + j * S[i - 1][j]) % mod; } } ll ans = 0; rep (i, 1, n + 1) { rep (j, 1, i + 1) { ans += C[n][i] * S[i][j] % mod * modpow(j * (j - 1), n - i, mod); ans %= mod; } } cout << ans << endl; return 0; }