#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
long long c[4005][4005];
long long dp[4005][4005];
int main() {
  int n;
  cin >> n;
  memset(c, 0, sizeof(c));
  for (int i = 0; i < 4001; i++) {
    c[i][0] = 1;
    c[i][i] = 1;
  }
  for (int i = 1; i < 4001; i++) {
    for (int j = 1; j < i + 1; j++) {
      c[i + 1][j] = (c[i][j] + c[i][j - 1]) % mod;
    }
  }
  dp[0][0] = 1;
  dp[1][1] = 1;
  for (int i = 2; i < 4001; i++) {
    dp[i][1] = dp[i - 1][i - 1];
    for (int j = 2; j < i + 1; j++) {
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 1]) % mod;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = (ans + dp[i][i] * c[n][i]) % mod;
  }
  cout << ans << endl;
  return 0;
}
