#include <bits/stdc++.h>
using namespace std;
int dp[4005];
long long jc[4005];
long long c[4005][4005];
const long long Mod = 1e9 + 7;
int n;
void init() {
  jc[1] = 1;
  for (int i = 2; i <= 4000; i++) {
    jc[i] = jc[i - 1] * i % Mod;
  }
  for (int i = 0; i <= n; i++) {
    c[i][0] = 1;
  }
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 1; j <= i; j++) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % Mod;
    }
  }
}
int main() {
  cin >> n;
  init();
  dp[0] = 1;
  dp[1] = 1;
  for (int i = 2; i <= n + 1; i++) {
    for (int j = 0; j <= i - 1; j++) {
      dp[i] = (dp[i] + c[i - 1][j] * dp[j] % Mod) % Mod;
    }
  }
  cout << (dp[n + 1] - dp[n] + Mod) % Mod;
  return 0;
}
