#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:1024000000,1024000000")
const long double pi = acosl(-1.);
int T;
const long long mod = 1000000007;
long long gcd(long long x, long long y) {
  if (!y) return x;
  return gcd(y, x % y);
}
long long quickfind(long long x, long long y) {
  long long result = 1;
  while (y) {
    if (y & 1) result = result * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return result;
}
using namespace std;
long long f[4444] = {0};
long long inv[4444] = {0};
long long dp[4444][4444] = {0};
int n;
long long C(int m, int n) { return f[m] * inv[n] % mod * inv[m - n] % mod; }
int main() {
  f[0] = inv[0] = 1;
  for (int i = 1; i <= 4000; i++)
    f[i] = f[i - 1] * i % mod, inv[i] = quickfind(f[i], mod - 2);
  cin >> n;
  dp[0][0] = 1;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= i; j++)
      if (dp[i][j])
        dp[i + 1][j + 1] += dp[i][j], dp[i + 1][j + 1] %= mod,
            dp[i + 1][j] += dp[i][j] * j, dp[i + 1][j] %= mod;
  long long ans = 0;
  for (int i = 0; i <= n - 1; i++) {
    long long tot = 0;
    for (int j = 0; j <= i; j++) tot += dp[i][j];
    tot %= mod;
    ans += C(n, i) * tot;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
