#include typedef long long int ll; constexpr int kMod = int(1E9 + 7), kN = int(1E5 + 10); ll f[kN], inf[kN]; ll Pow(ll a, ll b) { ll ans = 1; while (b) { if (b & 1) ans = ans * a % kMod; a = a * a % kMod; b >>= 1; } return ans; } ll Rev(ll n) {return Pow(n, kMod - 2) % kMod;} ll C(ll n, ll m) {return f[n] * inf[n - m] % kMod * inf[m] % kMod;} void pre() { f[0] = f[1] = inf[0] = inf[1] = 1; for (int i = 2; i < kN; i++) f[i] = f[i - 1] * i % kMod; inf[kN - 1] = Rev(f[kN - 1]); for (int i = kN - 2; i > 1; i--) inf[i] = inf[i + 1] * (i + 1) % kMod; } int main() { int n; ll ans = 1; scanf("%d", &n); pre(); for (int i = 1; i <= n; i++) ans += C(n, i) * Pow(n - i, i) % kMod; printf("%lld\n", ans % kMod); }