#include <bits/stdc++.h>
using namespace std;
const int maxn = 4001;
long long dp[maxn], pascal[maxn][maxn], ans, mod = 1e9 + 7;
void init() {
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j <= i; j++) {
      if (i == j || j == 0)
        pascal[i][j] = 1;
      else
        pascal[i][j] = (pascal[i - 1][j] + pascal[i - 1][j - 1]) % mod;
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  init();
  int n;
  cin >> n;
  dp[0] = 1;
  for (int i = 1; i < maxn; i++) {
    for (int j = 0; j <= i - 1; j++) {
      dp[i] += (pascal[i - 1][j] * dp[i - j - 1]) % mod;
      dp[i] %= mod;
    }
  }
  for (int i = 0; i < n; i++) {
    ans += (dp[i] * pascal[n][n - i]) % mod;
    ans %= mod;
  }
  cout << ans;
  return 0;
}
