#include <bits/stdc++.h>
using namespace std;
int n, P = 1e9 + 7, f[4010], C[4010][4010];
void read(int& x) {
  char ch = getchar();
  int mk = 1;
  for (; (ch != '-') && (ch < '0' || ch > '9'); ch = getchar())
    ;
  if (ch == '-') ch = getchar(), mk = -1;
  for (x = 0; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - 48;
  x *= mk;
}
int main() {
  read(n);
  int ans = 0, m = 1;
  C[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; j++) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
  }
  f[0] = f[1] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 0; j < i; j++)
      f[i] = (f[i] + (long long)f[j] * C[i - 1][j] % P) % P;
  for (int i = 1; i <= n; i++) {
    ans = (ans + (long long)f[n - i] * C[n][i] % P) % P;
  }
  printf("%d\n", ans);
  return 0;
}
