#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream& operator<<(ostream& o, const pair<T, U>& x) {
  o << "(" << x.first << ", " << x.second << ")";
  return o;
}
template <typename T>
ostream& operator<<(ostream& o, const vector<T>& x) {
  o << "[";
  int b = 0;
  for (auto& a : x) o << (b++ ? ", " : "") << a;
  o << "]";
  return o;
}
template <typename T>
ostream& operator<<(ostream& o, const set<T>& x) {
  o << "{";
  int b = 0;
  for (auto& a : x) o << (b++ ? ", " : "") << a;
  o << "}";
  return o;
}
template <typename T, typename U>
ostream& operator<<(ostream& o, const map<T, U>& x) {
  o << "{";
  int b = 0;
  for (auto& a : x) o << (b++ ? ", " : "") << a;
  o << "}";
  return o;
}
int n;
const long long int M = 1000000007;
long long int binom[4003][4003];
long long int F[4000];
long long int dp[4004][4004];
long long int g(int N, int c) {
  long long int& x = dp[N][c];
  if (x != -1) return x;
  if (c == 1 || N == c) return 1;
  return x = (g(N - 1, c - 1) + (g(N - 1, c) * c) % M) % M;
}
long long int f(int v) {
  if (F[v] != -1) return F[v];
  long long int ans = 0;
  for (int i = 1; i <= v; ++i) {
    ans += g(v, i);
    ans = ans % M;
  }
  return F[v] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (j == 0 || j == i)
        binom[i][j] = 1;
      else
        binom[i][j] = (binom[i - 1][j] + binom[i - 1][j - 1]) % M;
    }
    F[i] = -1;
  }
  F[0] = 1;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j) dp[i][j] = -1;
  long long int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += (binom[n][i] * f(n - i)) % M;
    ans = ans % M;
  }
  cout << ans << endl;
}
