#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
long long res[4005][2];
const long long M = 1000000007;
long long factorial[4020];
long long ppow(long long a, int b) {
  long long q = 1;
  for (int i = (31); i >= (0); --i) {
    q = (q * q) % M;
    if (b & (1 << i)) {
      q = (q * a) % M;
    }
  }
  return q;
};
long long inv(long long a) { return ppow(a, M - 2); };
long long binomm[4010][4010];
long long binom(long long s, long long k) { return binomm[s][k]; }
int main() {
  int n;
  scanf("%d", &n);
  res[0][0] = 1;
  res[0][1] = 0;
  for (int i = 0; i < (n + 10); ++i) {
    binomm[i][0] = 1;
    for (int j = (1); j <= (i); ++j)
      binomm[i][j] = (binomm[i - 1][j] + binomm[i - 1][j - 1]) % M;
  };
  for (int i = (1); i <= (n); ++i) {
    res[i][0] = (res[i - 1][0] * 2) % M;
    res[i][1] = (res[i - 1][1] + res[i - 1][0]) % M;
    for (int j = (2); j <= (i); ++j) {
      res[i][0] += (res[i - j][0] * binom(i - 1, j - 1)) % M;
      res[i][0] %= M;
      res[i][1] += (res[i - j][1] * binom(i - 1, j - 1)) % M;
      res[i][1] %= M;
    }
  };
  printf("%I64d\n", res[n][1]);
  return 0;
}
