#include <bits/stdc++.h>
using namespace std;
long long C[4003 + 2][4003 + 2];
void pascal() {
  for (int i = 0; i < 4003; ++i) C[i][i] = C[i][0] = 1;
  for (int i = 2; i < 4003; ++i) {
    for (int j = 1; j < i; ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007LL;
  }
}
long long pd[4003 + 2];
long long spd[4003];
long long proc(int N) {
  pd[1] = 1;
  pd[2] = 3;
  pd[3] = 10;
  if (N < 4) return pd[N];
  spd[1] = 1;
  spd[2] = 4;
  spd[3] = 14;
  for (int n = 4; n <= N; n++) {
    for (int i = 2; i < n; i++) {
      pd[n] = (pd[n] + (spd[i - 1] * C[n][i]) % 1000000007LL) % 1000000007LL;
    }
    for (int i = 0; i < n; i++) {
      pd[n] = (pd[n] + C[n][i]) % 1000000007LL;
    }
    spd[n] = (spd[n - 1] + pd[n]) % 1000000007LL;
  }
  return pd[N];
}
int main() {
  pascal();
  int n;
  scanf("%d", &n);
  printf("%lld\n", proc(n));
}
