#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxv = 4005;
long long S[maxv][maxv];
long long B[maxv];
long long C[maxv][maxv];
void init() {
  for (int i = 1; i < maxv; i++) {
    S[i][i] = 1;
  }
  B[0] = B[1] = 1;
  for (int i = 2; i < maxv; i++) {
    for (int j = 1; j < maxv; j++) {
      S[i][j] = (S[i - 1][j - 1] + S[i - 1][j] * j % mod) % mod;
      B[i] = (B[i] + S[i][j]) % mod;
    }
  }
  for (int i = 0; i < maxv; i++) {
    C[i][i] = 1;
    C[i][0] = 1;
  }
  for (int i = 1; i < maxv; i++) {
    for (int j = 1; j < maxv; j++) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
    }
  }
}
int main() {
  init();
  int n;
  while (cin >> n) {
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      ans = (ans + B[i] * C[n][i]) % mod;
    }
    cout << ans << endl;
  }
  return 0;
}
