#include <bits/stdc++.h>
using namespace std;
long long C[4005][4005];
long long dp[4005];
const long long mod = (long long)1e9 + 7;
long long f(int x) {
  if (x == 0) return 0;
  if (x == 1) return 1;
  long long &ans = dp[x];
  if (ans != -1) return ans;
  ans = 0;
  for (int i = 0; i < x; i++) {
    ans += (C[x - 1][i] * f(i)) % mod;
  }
  return ans;
}
long long exp(long long a, int b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
int main() {
  C[0][0] = 1;
  for (int i = 1; i <= 4000; i++) {
    C[i][0] = C[i - 1][i - 1];
    for (int j = 1; j <= i; j++) {
      C[i][j] = (C[i][j - 1] + C[i - 1][j - 1]) % mod;
    }
  }
  int n;
  cin >> n;
  if (n == 1)
    cout << "1\n";
  else {
    cout << C[n][n - 1] << endl;
  }
  return 0;
}
