#include <bits/stdc++.h>
using namespace std;
int dp[4010][4010];
int main() {
  int n;
  cin >> n;
  dp[0][0] = 1;
  for (int i = 1; i <= n + 1; i++) {
    dp[i][0] = dp[i - 1][i - 1];
    for (int j = 1; j <= i; j++)
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 1]) % 1000000007;
  }
  cout << (dp[n + 1][0] - dp[n][0] + 1000000007) % 1000000007;
  return 0;
}
