#include <bits/stdc++.h>
long long legit[4010];
long long nCk[4010][4010];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 4010; i++) {
    for (int j = 0; j <= i; j++) {
      if (!j || j == i) {
        nCk[i][j] = 1;
      } else {
        nCk[i][j] = nCk[i - 1][j];
        nCk[i][j] += nCk[i - 1][j - 1];
        nCk[i][j] %= 1000000007;
      };
    };
  };
  legit[0] = 1;
  long long erg = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      legit[i] += legit[i - j - 1] * nCk[i - 1][j];
      legit[i] %= 1000000007;
    };
    erg += nCk[n][i - 1] * legit[i - 1];
    erg %= 1000000007;
  };
  printf("%d\n", erg);
  return 0;
};
