#include <bits/stdc++.h>
using namespace std;
const long long N = 4005;
const long long Mod = 1000000007;
long long n, res, dp[N][N][2];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long work(long long i, long long s, long long x) {
  if (i == n) return x;
  long long &res = dp[i][s][x];
  if (res != -1) return res;
  res = 0;
  res =
      (work(i + 1, s, 1) + work(i + 1, s + 1, x) + work(i + 1, s, x) * s) % Mod;
  return res;
}
signed main() {
  n = read();
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", work(0, 0, 0));
  return 0;
}
