#include <bits/stdc++.h>
using namespace std;
const int N = 4e3 + 10, mod = 1e9 + 7;
int dp[N], n, fc[N], ifc[N], ans;
int power(int a, int b) {
  if (b == 0) return 1;
  int rtr = power(a, b / 2);
  if (b % 2) return 1ll * rtr * rtr % mod * a % mod;
  return 1ll * rtr * rtr % mod;
}
void Pre() {
  fc[0] = ifc[0] = 1;
  for (int i = 1; i < N - 5; i++) {
    fc[i] = 1ll * fc[i - 1] * i % mod;
    ifc[i] = 1ll * power(fc[i], mod - 2);
  }
}
int ch(int x, int y) { return 1ll * fc[y] * ifc[x] % mod * ifc[y - x] % mod; }
int main() {
  cin >> n;
  Pre();
  dp[0] = 1;
  if (n % 2 == 0)
    ans--;
  else
    ans++;
  for (int i = 1; i < n; i++) {
    dp[i] = dp[i - 1];
    for (int j = 1; j <= i; j++)
      dp[i] = (dp[i] + 1ll * ch(j - 1, i - 1) * dp[i - j] % mod) % mod;
    if (i % 2 == (n - 1) % 2)
      ans += 1ll * ch(i, n) * dp[i] % mod, ans %= mod;
    else
      ans -= 1ll * ch(i, n) * dp[i] % mod, ans %= mod;
  }
  cout << (ans + mod) % mod;
  return 0;
}
