#include <bits/stdc++.h>
using namespace std;
long long c[4005][4005];
long long f[4005][4005];
long long Fu[4005];
int n;
const long long mol = 1e9 + 7;
void init() {
  memset(c, 0, sizeof c);
  memset(f, 0, sizeof f);
  memset(Fu, 0, sizeof Fu);
  for (int i = 0; i < 4005; i++) c[i][0] = 1;
  for (int i = 1; i < 4005; i++) {
    for (int j = 1; j < 4005; j++)
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mol;
  }
  f[1][1] = 1;
  Fu[1] = 1;
  Fu[0] = 1;
  for (int n1 = 2; n1 < 4005; n1++) {
    for (int m1 = 1; m1 <= n1; m1++) {
      f[n1][m1] = (f[n1 - 1][m1 - 1] + m1 * f[n1 - 1][m1]) % mol;
      Fu[n1] = (Fu[n1] + f[n1][m1]) % mol;
    }
  }
}
int main() {
  init();
  while (~scanf("%d", &n)) {
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      ans = (ans + c[n][i] * Fu[n - i]) % mol;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
