#include <bits/stdc++.h>
const long long inf = std::numeric_limits<long long>::max();
using namespace std;
const long long mod = 1000000007;
long long dp[4100], dp2[4100][4100], dp3[4100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  dp2[1][0] = 1;
  dp2[1][1] = 1;
  dp2[2][0] = 1;
  dp2[2][1] = 2;
  dp2[2][2] = 1;
  for (long long i = 3; i < 4100; i++) {
    dp2[i][0] = 1;
    dp2[i][i] = 1;
    for (long long j = 1; j < i; j++) {
      dp2[i][j] = dp2[i - 1][j - 1] + dp2[i - 1][j];
      dp2[i][j] %= mod;
    }
  }
  dp[0] = 1;
  dp[1] = 1;
  dp[2] = 2;
  for (long long i = 3; i < 4100; i++) {
    for (long long j = 0; j < i; j++) {
      dp[i] += dp[i - j - 1] * dp2[i - 1][j];
      dp[i] %= mod;
    }
  }
  long long ans = 1;
  for (long long i = 1; i < n; i++) {
    ans += dp[n - i] * dp2[n][i];
    ans %= mod;
  }
  cout << ans;
  return 0;
}
