#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MAX = 5000;
const int MOD = 1000000007;
int C[MAX][MAX];
int CL[MAX];
int main() {
  int n;
  cin >> n;
  C[0][0] = 1;
  for (int i = (1); i < (n + 1); ++i) {
    C[i][0] = 1;
    for (int j = (1); j < (n + 1); ++j) {
      C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
      if (C[i][j] >= MOD) C[i][j] -= MOD;
    }
  }
  CL[0] = 1;
  for (int i = (1); i < (n + 1); ++i) {
    CL[i] = 0;
    for (int j = (1); j < (i + 1); ++j) {
      long long c = C[i - 1][j - 1];
      c *= CL[i - j];
      c %= MOD;
      CL[i] += c;
      if (CL[i] >= MOD) CL[i] -= MOD;
    }
  }
  long long res = 0;
  for (int i = (1); i < (n + 1); ++i) {
    long long c = C[n][i];
    int m = n - i;
    c *= CL[m];
    c %= MOD;
    res += c;
    if (res >= MOD) res -= MOD;
  }
  cout << res << endl;
  return 0;
}
