#include <bits/stdc++.h>
using namespace std;
unsigned long long part[4001];
unsigned long long pmod(unsigned long long n, int exp) {
  unsigned long long x = 1, y = n;
  while (exp > 0) {
    if (1 == (exp % 2)) {
      x = x * y;
      if (x > 1000000007) x = x % 1000000007;
    }
    y = y * y;
    if (y > 1000000007) y = y % 1000000007;
    exp /= 2;
  }
  return x;
}
unsigned long long inv(unsigned long long x) { return pmod(x, 1000000007 - 2); }
unsigned long long Rfact[4001];
unsigned long long Ifact[4001];
unsigned long long fact(int x) {
  if (!Rfact[x]) {
    unsigned long long ret = 1;
    for (int i = x; i >= 2; i--) {
      ret = (ret * i) % 1000000007;
    }
    Rfact[x] = ret;
  }
  return Rfact[x];
}
unsigned long long inv_fact(int x) {
  if (!Ifact[x]) {
    Ifact[x] = inv(fact(x));
  }
  return Ifact[x];
}
unsigned long long com(int n, int r) {
  unsigned long long ret = fact(n);
  ret = (ret * inv_fact(n - r)) % 1000000007;
  ret = (ret * inv_fact(r)) % 1000000007;
  return ret;
}
int main() {
  part[0] = part[1] = 1;
  for (int i = 2; i <= 4000; i++) {
    for (int j = 0; j < i; j++) {
      unsigned long long tadd = (com(i - 1, j) * part[j]) % 1000000007;
      part[i] = (part[i] + tadd) % 1000000007;
    }
  }
  int n;
  cin >> n;
  unsigned long long ret = 0;
  for (int i = 1; i <= n; i++) {
    unsigned long long tadd = (com(n, i) * part[n - i]) % 1000000007;
    ret = (ret + tadd) % 1000000007;
  }
  cout << ret << endl;
  return 0;
}
