#include <bits/stdc++.h>
using namespace std;
const int Mod = (int)1e9 + 7;
long long bell[4005];
long long C[4005];
int main() {
  bell[0] = bell[1] = 1;
  C[0] = 1;
  for (int i = (2), _t = (4005 - 1); i <= _t; ++i) {
    C[i - 1] = bell[i - 1];
    for (int j = (i - 2), _t = (0); j >= _t; --j)
      C[j] = (C[j] + C[j + 1]) % Mod;
    bell[i] = C[0];
  }
  int n;
  scanf("%d", &n);
  printf("%lld\n", (bell[n + 1] - bell[n] + Mod) % Mod);
  return 0;
}
