#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const long long P = 1e9 + 7;
const int M = 200005;
int n;
long long fac[M], rev[M], c[4005][4005];
void init() {
  fac[0] = 1, rev[1] = 1, rev[0] = 1;
  for (int i = 1; i < M; i++) fac[i] = (fac[i - 1] * i) % P;
  for (int i = 2; i < M; i++) rev[i] = (P - P / i) * rev[P % i] % P;
  for (int i = 2; i < M; i++) rev[i] = rev[i] * rev[i - 1] % P;
  c[0][0] = c[1][1] = 1;
  for (int i = (2); i <= (int)(4000); i++) {
    c[i][1] = c[i - 1][i - 1];
    for (int j = (2); j <= (int)(i); j++)
      c[i][j] = (c[i][j - 1] + c[i - 1][j - 1]) % P;
  }
}
long long C(int x, int y) {
  if (y >= x) return 1;
  return fac[x] * rev[y] % P * rev[x - y] % P;
}
void sl() {
  long long ans = 0;
  for (int i = (0); i < (int)(n); i++) (ans += C(n, i) * c[i][i]) %= P;
  printf("%lld\n", ans);
}
int main() {
  init();
  while (~scanf("%d", &n)) {
    sl();
  }
  return 0;
}
