#include <bits/stdc++.h>
using namespace std;
const int pp = (1e9) + 7;
int N;
int f[4010], ff[4010], ps[4010];
int c[4010][4010], p[4010][4010];
int quick(int x, int y) {
  int s = 1, t = x;
  for (; y; y >>= 1) {
    if (y & 1) s = (long long)s * t % pp;
    t = (long long)t * t % pp;
  }
  return s;
}
int main() {
  scanf("%d", &N);
  c[0][0] = 1;
  for (int i = 1; i <= N; i++)
    for (int j = 0; j <= i; j++) {
      c[i][j] = c[i - 1][j];
      if (j) c[i][j] = (c[i][j] + c[i - 1][j - 1]) % pp;
    }
  p[1][1] = 1;
  for (int i = 2; i <= N; i++)
    for (int j = 1; j <= i; j++)
      p[i][j] = (p[i - 1][j - 1] + (long long)p[i - 1][j] * j % pp) % pp;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= i; j++) ps[i] = (ps[i] + p[i][j]) % pp;
  ps[0] = 1;
  ff[0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= i; j++)
      f[i] = (f[i] + (long long)ps[i - j] * c[i][j] % pp) % pp;
    ff[i] = ps[i] - f[i];
  }
  printf("%d", f[N]);
}
