#include <bits/stdc++.h>
using namespace std;
long long C[4010][4010], F[4010], mod = 1e9 + 7;
int main() {
  int n, i, j;
  scanf("%d", &n);
  C[0][0] = 1;
  for (i = 1; i <= n; 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;
    }
  }
  F[0] = F[1] = 1;
  for (i = 2; i <= n; i++) {
    for (j = 0; j <= i; j++) F[i] = (F[i] + (C[i - 1][j] * F[j]) % mod) % mod;
  }
  long long ans = 0;
  for (i = 1; i <= n; i++) ans = (ans + (C[n][i] * F[n - i]) % mod) % mod;
  printf("%I64d\n", ans);
}
