#include <bits/stdc++.h>
const int mod = 1e9 + 7;
long long _pow[10000] = {};
long long B[10000];
long long C[4100][4100];
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  _pow[0] = 1;
  for (int i = 1; i <= n; i++) _pow[i] = _pow[i - 1] * 2 % mod;
  C[1][0] = 1, C[1][1] = 1;
  for (int i = 2; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= n + 1; j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  }
  B[0] = 1;
  B[1] = 1, B[2] = 2;
  for (int i = 3; i <= n; i++) {
    for (int j = 0; j <= n; j++)
      B[i] = (B[i] + (C[i - 1][j] * B[j] % mod)) % mod;
  }
  long long ans = 0;
  long long tmp = 1;
  for (int i = 0; i <= n - 1; i++) {
    ans = (ans + B[i] * C[n][i] % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
