#include <bits/stdc++.h>
using namespace std;
char IO;
inline long long rd() {
  long long res = 0, f = 1;
  while (IO = getchar(), IO < 48 || IO > 57)
    if (IO == '-') f = 0;
  do res = (res << 3) + (res << 1) + (IO ^ 48);
  while (IO = getchar(), IO >= 48 && IO <= 57);
  if (f) return res;
  return -res;
}
const long long P = 1e9 + 7, M = 4005;
long long C[M][M], dp[M][M], ans;
int main() {
  long long n = rd();
  C[0][0] = 1;
  for (long long i = 1, iend = n; i <= iend; ++i) {
    C[i][0] = 1;
    for (long long j = 1, jend = i; j <= jend; ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
  }
  dp[0][0] = 1;
  for (long long i = 1, iend = n; i <= iend; ++i)
    for (long long j = 1, jend = i; j <= jend; ++j)
      dp[i][j] = (dp[i - 1][j] * j % P + dp[i - 1][j - 1]) % P;
  for (long long i = 0, iend = n - 1; i <= iend; ++i)
    for (long long j = 0, jend = i; j <= jend; ++j)
      ans = (ans + dp[i][j] * C[n][i] % P) % P;
  cout << ans << endl;
}
