#include <bits/stdc++.h>
using namespace std;
const int MODULO = 1000000007;
const int NMAX = 4005;
int n, fact[NMAX], part[NMAX][NMAX], ans[NMAX];
int sol;
inline int Log(int x, int y) {
  int p = 1;
  while (y) {
    if (y & 1) p = (1LL * p * x) % MODULO;
    x = (1LL * x * x) % MODULO;
    y >>= 1;
  }
  return p;
}
inline int Comb(int x, int y) {
  int aux;
  aux = (1LL * fact[x] * Log(fact[y], MODULO - 2)) % MODULO;
  aux = (1LL * aux * Log(fact[x - y], MODULO - 2)) % MODULO;
  return aux;
}
int main() {
  int i, j, aux;
  cin.sync_with_stdio(false);
  cin >> n;
  fact[0] = fact[1] = 1;
  for (i = 2; i < NMAX; i++) fact[i] = (1LL * fact[i - 1] * i) % MODULO;
  part[1][1] = 1;
  ans[0] = ans[1] = 1;
  for (i = 2; i <= n; i++)
    for (j = 1; j <= i; j++) {
      part[i][j] =
          (1LL * part[i - 1][j - 1] + 1LL * part[i - 1][j] * j) % MODULO;
      ans[i] += part[i][j];
      if (ans[i] >= MODULO) ans[i] -= MODULO;
    }
  for (i = n; i >= 1; i--)
    sol = (1LL * sol + 1LL * Comb(n, i) * ans[n - i]) % MODULO;
  cout << sol << "\n";
  return 0;
}
