#include <bits/stdc++.h>
using namespace std;
long long memo[4001][4001];
long long memo2[4001];
long long choose(int n, int k) {
  if (n == 1 or n == k or k == 0) {
    return 1;
  } else if (memo[n][k] != -1) {
    return memo[n][k];
  } else {
    return memo[n][k] = (choose(n - 1, k) + choose(n - 1, k - 1)) % 1000000007;
  }
}
long long ways(int n) {
  if (n == 0) {
    return 1;
  } else if (memo2[n] != -1) {
    return memo2[n];
  } else {
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      long long aux = (choose(n - 1, i - 1) * ways(n - i)) % 1000000007;
      ans = (ans + aux) % 1000000007;
    }
    return memo2[n] = ans;
  }
}
int main() {
  memset(memo, -1, sizeof memo);
  memset(memo2, -1, sizeof memo2);
  int n;
  cin >> n;
  long long p[4001];
  p[0] = 1;
  for (int i = 1; i < 4001; i++) {
    p[i] = (p[i - 1] * 2) % 1000000007;
  }
  long long ans = 1;
  for (int i = n - 1; i >= 1; i--) {
    long long aux = ways(i);
    aux = (aux * choose(n, i)) % 1000000007;
    ans = (aux + ans) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
