#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool RD(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
template <class T>
inline void PT(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) PT(x / 10);
  putchar(x % 10 + '0');
}
const int N = 4000 + 123;
const int MOD = 1e9 + 7;
int bell[N][N];
int C[N][N];
int main() {
  bell[0][0] = 1;
  for (int i = 1; i <= int(N - 10); i++)
    for (int j = 1; j <= int(i); j++) {
      if (j == 1)
        bell[i][j] = bell[i - 1][i - 1];
      else
        bell[i][j] = (bell[i][j - 1] + bell[i - 1][j - 1]) % MOD;
    }
  for (int i = 1; i <= int(N - 10); i++) {
    C[i][i] = C[i][0] = 1;
    for (int j = 1; j <= int(i - 1); j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
  }
  int n;
  while (~scanf("%d", &n)) {
    long long ans = 0;
    for (int i = 0; i < int(n); i++)
      ans = (ans + C[n][i] * (long long)bell[i][i]) % MOD;
    PT(ans), puts("");
  }
}
