#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const double INF = DBL_MAX;
bool iszero(const double a) { return fabs(a) <= eps; }
double sqr(const double a) { return a * a; }
int sgn(const double a) {
  if (a < -eps) return -1;
  return (a > eps);
}
int cmp(const double a, const double b) { return sgn(a - b); }
int inint() {
  int t;
  scanf("%d", &t);
  return t;
}
const int N = 4010;
const long long p = 1e9 + 7;
struct ll {
  long long l;
  ll(long long a = 0) : l(a % p) {}
  ll operator+(ll a) { return (l + a.l) % p; }
  ll operator+=(ll a) {
    l = (l + a.l) % p;
    return *this;
  }
  ll operator+(long long a) { return ll((l + a) % p); }
  ll operator+=(long long a) {
    l = (l + a) % p;
    return *this;
  }
  ll operator*(ll a) { return ll((l * a.l) % p); }
  ll operator*(long long a) { return ll((l * a) % p); }
  ll operator=(long long a) {
    l = a % p;
    return *this;
  }
  ll operator=(ll a) {
    l = a.l % p;
    return *this;
  }
  long long operator*() { return l; }
};
ll C[N][N];
void init() {
  for (int i = 0; i < N; i++) C[i][0] = 1;
  for (int i = 1; i < N; i++)
    for (int j = 1; j <= i; j++) C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
ll a[N][N], bell[N], cnt[N];
void init2() {
  a[0][0] = bell[0] = 1;
  a[1][1] = bell[1] = 1;
  for (int i = 2; i < N; i++) {
    a[i][1] = a[i - 1][i - 1];
    for (int j = 2; j <= i; j++) a[i][j] = a[i][j - 1] + a[i - 1][j - 1];
    bell[i] = a[i][i];
  }
}
void solve() {
  int n = inint();
  ll ans;
  for (int i = 0; i < n; i++) ans += bell[i] * C[n][i];
  cout << (*ans) << endl;
}
int main() {
  init();
  init2();
  solve();
  return 0;
}
