#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const int N = 4010;
const double eps = 1e-10;
int n, m;
int F[N][N];
int main() {
  int i, j;
  scanf("%d", &n);
  memset(F, 0, sizeof(F));
  F[0][0] = 1;
  F[1][0] = 1;
  F[1][1] = 2;
  for (i = 2; i <= n; i++) {
    F[i][0] = F[i - 1][i - 1];
    for (j = 1; j <= i; j++) {
      F[i][j] = F[i][j - 1] + F[i - 1][j - 1];
      if (F[i][j] >= MOD) F[i][j] -= MOD;
    }
  }
  printf("%d", F[n][n - 1]);
  return 0;
}
