#include <bits/stdc++.h>
using namespace std;
const int maxn = 4010, mod = 1e9 + 7;
long long bell[maxn][maxn];
long long calc_bell(int n) {
  bell[1][1] = 1;
  for (int i = 2; i <= n + 1; i++) {
    bell[i][1] = bell[i - 1][i - 1];
    for (int j = 2; j <= i; j++) {
      bell[i][j] = (bell[i][j - 1] + bell[i - 1][j - 1]) % mod;
    }
  }
  return bell[n + 1][n];
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << calc_bell(n) << endl;
  return 0;
}
