#include <bits/stdc++.h>
using namespace std;
const int Max = 4e3 + 9, M = 1e9 + 7;
long long c[Max][Max], dp[2][Max];
long long C(int n, int r) {
  if (n == r || r == 0) return c[n][r] = 1;
  if (r > n) return 0;
  if (c[n][r]) return c[n][r];
  return c[n][r] = (C(n - 1, r - 1) + C(n - 1, r)) % M;
}
int main() {
  int n;
  cin >> n;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[0][i] = dp[0][i - 1];
    for (int j = 0; j < i; j++)
      dp[0][i] = (dp[0][i] + (C(i - 1, j) * dp[0][i - 1 - j])) % M;
  }
  for (int i = 1; i <= n; i++) {
    dp[1][i] = dp[0][i - 1];
    for (int j = 0; j < i; j++)
      dp[1][i] = (dp[1][i] + (C(i - 1, j) * dp[1][i - 1 - j])) % M;
  }
  cout << dp[1][n];
}
