#include <bits/stdc++.h>
using namespace std;
const long long maxN = 4e3 + 17, N = 1e5 + 7, MOD = 1e9 + 7, Mod = 1e9 + 6;
long long n, dp[maxN][maxN], d[maxN], ans[maxN], s[maxN];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  for (long long i = 1; i <= 4000; i++) dp[1][i] = i, dp[0][i] = 1;
  for (long long i = 2; i <= 4000; i++) {
    for (long long j = 1; j <= 4000; j++)
      dp[i][j] = (dp[i - 1][j - 1] + dp[i][j - 1]) % MOD;
  }
  cin >> n;
  d[0] = 1;
  d[1] = 1;
  for (long long i = 2; i <= n - 1; i++) {
    for (long long j = 0; j <= i - 1; j++)
      d[i] += (dp[j][i - 1] * d[i - 1 - j]) % MOD, d[i] %= MOD;
  }
  for (long long i = 1; i <= n - 1; i++) {
    for (long long j = 0; j <= i; j++)
      s[i] += (dp[j][i] * d[j]) % MOD, s[i] %= MOD;
  }
  ans[1] = 1;
  for (long long i = 2; i <= n; i++) {
    ans[i] = s[i - 1];
    for (long long j = 0; j <= i - 2; j++)
      ans[i] += (dp[j][i - 1] * ans[i - 1 - j]) % MOD, ans[i] %= MOD;
  }
  return cout << ans[n] << "\n", 0;
}
