#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define bitcount __builtin_popcountll
#define all(a) (a).begin(), (a).end()
using namespace std;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = 351, MOD = 1e9+7;
long long dp[N][N], nCk[N][N];
void add(long long& a, long long b) {
a += b;
if (a >= MOD) a -= MOD;
}
signed main() {
for (int i = 0; i < N; i++) {
nCk[i][0] = nCk[i][i] = 1;
for (int j = 1; j < i; j++) {
nCk[i][j] = (nCk[i-1][j] + nCk[i-1][j-1]) % MOD;
}
}
int n; cin >> n;
dp[0][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= n; j++) {
for (int g = 0; g <= j; g++) {
if (i == g) continue;
add(dp[i][j], nCk[j][g]*dp[i-1][j - g] % MOD);
}
// cout<<i<<' '<<j<<" "<<dp[i][j]<<"\n";
}
}
long long ans = 1;
for (int i = 0; i < n; i++) ans = ans*n % MOD;
cout << (MOD + ans - dp[n][n]) % MOD;
}