#include <bits/stdc++.h>
using namespace std;
long long ctos, modd = 1000000007, dos = 2;
long long P[4005], B[4005][4005], res;
long long bi(int n, int k) {
  if (n == k) return 1;
  if (k == 0) return 1;
  if (k > n) return 0;
  if (k == 1) return n;
  if (B[n][k] > 0) return B[n][k];
  B[n][k] = (bi(n - 1, k - 1) + bi(n - 1, k)) % modd;
  return B[n][k];
}
int main() {
  cin >> ctos;
  P[0] = 1;
  for (int i = 1; i <= ctos; i++) {
    for (int e = 0; e < i; e++) {
      P[i] += 1LL * P[i - e - 1] * bi(i - 1, e) % modd;
      P[i] %= modd;
    }
  }
  for (int i = 1; i <= ctos; i++) {
    res += P[ctos - i] * bi(ctos, i) % modd;
    res %= modd;
  }
  cout << res << endl;
  return 0;
}
