#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int maxn = 4005;
long long c[maxn][maxn], b[maxn];
int n;
void init() {
  c[0][0] = 1;
  int i, j;
  for (i = 1; i <= 4000; i++) {
    c[i][0] = c[i][i] = 1;
    for (j = 1; j < i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
  }
}
int main() {
  int i, j;
  init();
  scanf("%d", &n);
  b[0] = 1;
  for (i = 1; i < n; i++) {
    for (j = 0; j < i; j++) {
      b[i] = (b[i] + c[i - 1][j] * b[j]) % MOD;
    }
  }
  long long res = 0;
  for (i = 0; i < n; i++) res = (res + c[n][i] * b[i]) % MOD;
  printf("%I64d\n", res);
  return 0;
}
