#include <bits/stdc++.h>
using namespace std;
long long binomial[4005][4005];
long long bell[4005];
void initBin() {
  for (int i = 0; i < 4005; i++)
    for (int j = 0; j < 4005; j++) binomial[i][j] = 0;
  for (int i = 0; i < 4005; i++) {
    binomial[i][0] = 1;
    binomial[i][i] = 1;
  }
  for (int i = 0; i < 4005; i++) {
    for (int j = 1; j <= i; j++) {
      binomial[i][j] =
          (binomial[i - 1][j - 1] + binomial[i - 1][j]) % 1000000007;
    }
  }
}
int main() {
  initBin();
  bell[0] = 1;
  for (int i = int(1); i < int(4005); i++) {
    bell[i] = 0;
    for (int j = int(0); j < int(i); j++) {
      bell[i] =
          (bell[i] + (binomial[i - 1][j] * bell[j]) % 1000000007) % 1000000007;
    }
  }
  int n;
  cin >> n;
  cout << (1000000007 + bell[n + 1] - bell[n]) % 1000000007 << endl;
  return 0;
}
