#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e9;
const double eps = 1e-9;
long long B[4010];
void Bell() {
  int T[4010];
  B[0] = 1;
  B[1] = 1;
  T[0] = 1;
  for (int i = 2; i < 4010; i++) {
    T[i - 1] = B[i - 1];
    for (int j = i - 2; j >= 0; j--) T[j] = (T[j] + T[j + 1]) % mod;
    B[i] = T[0];
  }
}
int main() {
  Bell();
  int n;
  scanf("%d", &n);
  if (n == 1)
    puts("1");
  else {
    n--;
    printf("%I64d\n", (B[n + 2] - B[n + 1] + mod) % mod);
  }
  return 0;
}
