#include <bits/stdc++.h>
const int N = 1e5 + 10, mod = 1e9 + 7;
using namespace std;
int n, f[N], fac[N], inv[N];
template <class I>
inline void read(I &s) {
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    ;
  for (s = 0; isdigit(c); c = getchar()) s = s * 10 + c - 48;
}
template <class I>
inline void write(I x) {
  (x < 0 ? x = ~x + 1, putchar('-') : 0), (x > 9 ? write(x / 10) : void()),
      putchar(x % 10 + 48);
}
inline int mul(int a, int b) { return 1LL * a * b % mod; }
inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
inline int Power(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1) (b & 1 ? ans = mul(ans, a) : 0), a = mul(a, a);
  return ans;
}
inline int C(int n, int m) {
  if (n < m) return 0;
  return mul(mul(inv[n - m], inv[m]), fac[n]);
}
int main(void) {
  fac[0] = fac[1] = 1;
  for (int i = 2; i <= N - 10; ++i) fac[i] = mul(fac[i - 1], i);
  inv[N - 10] = Power(fac[N - 10], mod - 2);
  for (int i = N - 11; ~i; --i) inv[i] = mul(inv[i + 1], i + 1);
  read(n), f[0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < i; ++j)
      f[i] = add(f[i], mul(C(i - 1, j), f[i - j - 1]));
  int ans = 0;
  for (int i = 0; i < n; ++i) ans = add(ans, mul(C(n, i), f[i]));
  printf("%d\n", ans);
  return 0;
}
