#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& num) {
  bool start = false, neg = false;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = true;
    else if (c >= '0' && c <= '9') {
      start = true;
      num = num * 10 + c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
long long pow_mod(long long b, long long p, long long k) {
  long long res = 1;
  for (; p; p >>= 1) {
    if (p & 1) res = res * b % k;
    b = b * b % k;
  }
  return res;
}
const int maxn = 4005;
const int mo = (int)(1e9) + 7;
long long fac[maxn], ivf[maxn], B[maxn];
inline long long C(int n, int m) {
  return (fac[n] * ivf[n - m] % mo) * ivf[m] % mo;
}
int main() {
  int n;
  read(n);
  fac[0] = ivf[0] = 1;
  int mx = n;
  for (int i = (1); i <= (mx); i++) fac[i] = fac[i - 1] * i % mo;
  ivf[mx] = pow_mod(fac[mx], mo - 2, mo);
  for (int i = (mx - 1); i >= (1); i--) ivf[i] = ivf[i + 1] * (i + 1) % mo;
  B[0] = B[1] = 1;
  for (int i = (2); i <= (n); i++) {
    for (int j = (0); j <= (i - 1); j++) (B[i] += B[j] * C(i - 1, j)) %= mo;
  }
  long long res = 0;
  for (int i = (1); i <= (n); i++) (res += C(n, i) * B[n - i]) %= mo;
  printf("%lld\n", res);
  return 0;
}
