#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
}
template <typename T>
T abs(T &n) {
  return (n < 0 ? -n : n);
}
template <typename T>
T max(T &a, T &b) {
  return (!(a < b) ? a : b);
}
template <typename T>
T min(T &a, T &b) {
  return (a < b ? a : b);
}
template <typename T>
T mod(T a, T b) {
  return (a < b ? a : a % b);
}
long long mulmod(long long a, long long b, long long m) {
  long long q = (long long)(((long double)a * (long double)b) / (long double)m);
  long long r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T>
T power(T e, T n, T m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mod(x * p, m);
    p = mod(p * p, m);
    n >>= 1;
  }
  return x;
}
template <typename T>
T power(T e, T n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T InverseEuler(T a, T m) {
  return (a == 1 ? 1 : power(a, m - 2, m));
}
template <typename T>
T gcd(T a, T b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return (a * (b / gcd(a, b)));
}
long long dp[4050][4050];
long long eq[4050];
long long c[4050][4050];
void c_mod() {
  c[0][0] = c[1][0] = c[1][1] = 1;
  int i, j;
  for (i = 2; i < 4050; i++) {
    for (j = 0; j <= i; j++) {
      if (j == 0 || j == i) {
        c[i][j] = 1;
      } else {
        c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007ll;
      }
    }
  }
}
int main(int argc, char *argv[]) {
  io();
  long long n;
  cin >> n;
  c_mod();
  long long i, j;
  eq[0] = eq[1] = 1;
  dp[1][1] = 1;
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= i; j++) {
      dp[i][j] =
          (dp[i - 1][j - 1] + (j * dp[i - 1][j]) % 1000000007ll) % 1000000007ll;
      eq[i] += dp[i][j];
      eq[i] %= 1000000007ll;
    }
  }
  long long ans = 0;
  long long r = 0;
  for (r = 0; r < n; r++) {
    ans += (c[n][r] * eq[r]) % 1000000007ll;
    ans %= 1000000007ll;
  }
  cout << ans << '\n';
  return 0;
}
