#include <bits/stdc++.h>
using namespace std;
int ja[4002];
int BIGNUM = 1000000007;
int permutations[4002][4002];
int findc(int n, int k) {
  if (k > n) return 0;
  if (permutations[n][k] != 0) return permutations[n][k];
  if (n == 1) return 1;
  if (k == 0) return 1;
  return (permutations[n][k] =
              (findc(n - 1, k) + findc(n - 1, k - 1)) % BIGNUM);
}
int findj(int n) {
  ja[0] = 1;
  ja[1] = 1;
  ja[2] = 2;
  if (ja[n] != 0) return ja[n];
  int result = findj(n - 1);
  for (int i = 1; i <= n - 1; i++) {
    result =
        (result + (((long long)findc(n - 1, i)) * findj(n - 1 - i)) % BIGNUM) %
        BIGNUM;
  }
  return (ja[n] = result);
}
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  int result = findj(n + 1) - findj(n);
  cout << ((result >= 0) ? result : result + BIGNUM) << endl;
  return 0;
}
