#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7;
long long B[4010][4010];
int n;
void gao() {
  B[1][1] = 1;
  B[2][1] = 1;
  B[2][2] = 2;
  for (int i = 3; i < 4010; i++) {
    for (int j = 1; j < 4010; j++) {
      if (j == 1)
        B[i][j] = B[i - 1][i - 1];
      else
        B[i][j] = (B[i][j - 1] + B[i - 1][j - 1]) % MOD;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  gao();
  while (cin >> n) {
    cout << B[n + 1][n] << '\n';
  }
  return 0;
}
