#include <bits/stdc++.h>
using namespace std;
long long n, ans, f[4010][4010], mod = 1e9 + 7;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ '0');
    c = getchar();
  }
  return x * f;
}
int main() {
  n = read();
  f[0][0] = 1;
  for (int i = 1; i <= n + 1; i++) {
    f[i][0] = f[i - 1][i - 1];
    for (int j = 1; j <= i; j++)
      f[i][j] = (f[i][j - 1] + f[i - 1][j - 1]) % mod;
  }
  ans = (f[n + 1][0] - f[n][0] + mod) % mod;
  printf("%lld", ans);
  return 0;
}
