#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 4e3 + 6.9;
const long long mod = 1e9 + 7;
long long dp[MAXN][2];
long long C[MAXN][MAXN];
long long n;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i <= n; i++) {
    C[i][0] = 1;
    C[i][i] = 1;
    for (long long j = 1; j < i; j++) {
      C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
      C[i][j] %= mod;
    }
  }
  dp[0][0] = 1;
  dp[0][1] = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < i; j++) {
      dp[i][0] += dp[i - j - 1][0] * C[i - 1][j] % mod;
      dp[i][0] %= mod;
    }
    for (long long j = 1; j <= i; j++) {
      dp[i][1] += dp[i - j][0] * C[i][j] % mod;
      dp[i][1] %= mod;
    }
  }
  cout << dp[n][1];
}
