#include <bits/stdc++.h>
using namespace std;
inline void scanint(int &x) {
  register int c = 0;
  x = 0;
  int flag = 0;
  for (; ((c != 45) && (c < 48 || c > 57)); c = getchar())
    ;
  for (; ((c == 45) || (c > 47 && c < 58)); c = getchar()) {
    if (c == 45)
      flag = 1;
    else
      x = (x << 1) + (x << 3) + c - 48;
  }
  if (flag) x = -x;
}
inline void writeint(int n) {
  int N = n, rev, count = 0;
  rev = N;
  if (N == 0) {
    putchar('0');
    putchar('\n');
    return;
  }
  while ((rev % 10) == 0) {
    count++;
    rev /= 10;
  }
  rev = 0;
  while (N != 0) {
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) {
    putchar(rev % 10 + '0');
    rev /= 10;
  }
  while (count--) putchar('0');
}
vector<long long> bell[4005];
long long c[4005][4005];
int main() {
  int t, n, m, i, j, k, l, ans, count, temp, sum, flag;
  bell[0].push_back(1);
  bell[1].push_back(1);
  k = 1;
  for (i = 2; i < 4003; i++) {
    bell[i].push_back(bell[i - 1][bell[i - 1].size() - 1]);
    for (j = 1; j < k + 1; j++)
      bell[i].push_back((bell[i][j - 1] + bell[i - 1][j - 1]) % 1000000007);
    k++;
  }
  c[0][0] = 1;
  for (i = 1; i < 4005; i++) {
    c[i][0] = 1;
    for (j = 1; j < i + 2; j++) {
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007;
    }
  }
  cin >> n;
  long long aa = 0;
  for (i = 0; i < n; i++) {
    aa = (aa + (c[n][i] * bell[i][bell[i].size() - 1]) % 1000000007) %
         1000000007;
  }
  cout << aa;
  return 0;
}
