#include <bits/stdc++.h>
const int maxn = 1e5 + 100, mod = 1e9 + 7;
using namespace std;
int dp[4005][4005];
int main() {
  int n;
  cin >> n;
  dp[0][0] = 1;
  for (int(i) = (1); (i) < (n + 1); ++(i)) {
    for (int(j) = (0); (j) < (i + 1); ++(j)) {
      if (j == 0)
        dp[i][j] = dp[i - 1][i - 1];
      else
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 1]) % mod;
    }
  }
  cout << dp[n][n - 1] << endl;
  return 0;
}
