#include <bits/stdc++.h>
using namespace std;
long long m = 1e9 + 7;
long long c[4010][4010];
long long dp[4010];
int main() {
  c[0][1] = 0;
  for (int i = 0; i <= 4000; i++) c[i][0] = 1;
  for (int i = 1; i <= 4000; i++) {
    for (int j = 1; j < i + 2; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % m;
  }
  dp[0] = 1;
  for (int i = 1; i <= 4000; i++) {
    dp[i] = 0;
    for (int j = 0; j < i; j++) {
      dp[i] = (dp[i] + dp[i - j - 1] * c[i - 1][j]) % m;
    }
  }
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 0; i < n; i++) ans = (ans + dp[i] * c[n][i]) % m;
  cout << ans;
  return 0;
}
