#include <bits/stdc++.h>
using namespace std;
long long dp[4005][4005];
const int mod = 1000000007;
int main() {
  dp[1][1] = 1;
  int n;
  cin >> n;
  for (int i = 2; i <= n + 1; i++) {
    for (int j = 1; j <= i; j++) {
      if (j == 1)
        dp[i][j] = dp[i - 1][i - 1];
      else
        dp[i][j] = (dp[i - 1][j - 1] + dp[i][j - 1]) % mod;
    }
  }
  cout << dp[n + 1][n] << endl;
}
