#include <bits/stdc++.h>
using namespace std;
const int N = 4001, M = 1e9 + 7;
int n, dp[N][N], fact[N], inv[N], sum[N];
int power(int base, int to) {
  int ret = 1;
  while (to) {
    if (to & 1) ret = ret * 1LL * base % M;
    to >>= 1;
    base = base * 1LL * base % M;
  }
  return ret;
}
void add(int &a, int b) {
  a += b;
  if (a >= M) a -= M;
}
int choose(int n, int k) {
  return (fact[n] * 1LL * inv[k] % M) * 1LL * inv[n - k] % M;
}
int main() {
  scanf("%d", &n);
  inv[0] = fact[0] = inv[0] = 1;
  for (int i = 1; i < N; i++) fact[i] = fact[i - 1] * 1LL * i % M;
  inv[N - 1] = power(fact[N - 1], M - 2);
  for (int i = N - 2; i; i--) inv[i] = inv[i + 1] * (i + 1LL) % M;
  dp[0][0] = 1;
  sum[0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= n; j++) {
      if (j) add(sum[i], dp[i][j]);
      add(dp[i + 1][j], dp[i][j] * 1LL * j % M);
      add(dp[i + 1][j + 1], dp[i][j]);
    }
  int ans = 0;
  for (int i = 1; i <= n; i++) add(ans, choose(n, i) * 1LL * sum[n - i] % M);
  printf("%d\n", ans);
}
