#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
const double E = 2.718281828459;
const long long int MOD = 1000000007;
long long int comb[4002][4002];
long long int pot2[4002];
long long int DP[4002];
int main() {
  int n;
  cin >> n;
  pot2[0] = 1;
  for (int i = 1; i < 4002; i++) pot2[i] = (pot2[i - 1] * 2) % MOD;
  long long int ans = 1;
  for (int i = 0; i <= n; i++) comb[i][0] = 1, comb[0][i] = 0;
  comb[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % MOD;
  DP[1] = 1;
  for (int N = 2; N <= n; N++) {
    DP[N] = 1;
    for (int k = 1; k < N; k++) {
      DP[N] = (DP[N] + (DP[k] * comb[N - 1][k]) % MOD) % MOD;
    }
  }
  for (int k = 1; k < n; k++) {
    ans = (ans + (comb[n][k] * DP[k]) % MOD) % MOD;
  }
  printf("%I64d", ans);
  return 0;
}
