#include <bits/stdc++.h>
const int delta = 1000000007;
using namespace std;
long long efr[4000][4000];
long long eqr[4000];
long long nCr[4001][4001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      if (i == 0 && j == 0)
        efr[i][j] = 1;
      else if (j == 0)
        efr[i][j] = (efr[i - 1][j] * j) % delta;
      else if (i != 0)
        efr[i][j] = (efr[i - 1][j] * j + efr[i - 1][j - 1]) % delta;
      eqr[i] = (eqr[i] + efr[i][j]) % delta;
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0)
        nCr[i][j] = 1;
      else
        nCr[i][j] = (nCr[i - 1][j] + nCr[i - 1][j - 1]) % delta;
    }
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    s = (s + (eqr[i] * nCr[n][i]) % delta) % delta;
  }
  cout << s;
  return 0;
}
