#include <bits/stdc++.h>
using namespace std;
const int maxn = 4005;
long long dp[maxn][maxn];
long long dp2[maxn][maxn];
const int mod = 1000000007;
int main() {
  dp[0][0] = 1;
  for (int i = 1; i < maxn; i++) {
    for (int j = 0; j <= i - 1; j++) {
      (dp[i][j + 1] += dp[i - 1][j]) %= mod;
      (dp[i][j] += dp[i - 1][j] * (j + 1)) %= mod;
    }
  }
  dp2[1][1] = 1;
  for (int i = 2; i < maxn; i++)
    for (int j = 1; j <= i - 1; j++) {
      (dp2[i][j + 1] += dp2[i - 1][j]) %= mod;
      (dp2[i][j] += dp2[i - 1][j] * j) %= mod;
    }
  int n;
  while (cin >> n) {
    long long ans = 0, ans2 = 0;
    for (int i = 0; i <= n; i++) (ans += dp[n][i]) %= mod;
    for (int i = 1; i <= n; i++) (ans2 += dp2[n][i]) %= mod;
    ans = (ans - ans2 + mod) % mod;
    cout << ans << endl;
  }
  return 0;
}
