#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
int n;
const int maxn = 4010, mod = 1e9 + 7;
long long dp[maxn][maxn][2];
long long doit(int i, int groups, int ig) {
  if (i == n) return ig;
  long long& ret = dp[i][groups][ig];
  if (ret != -1) return ret;
  ret = 0;
  ret = (doit(i + 1, groups, 1) + doit(i + 1, groups + 1, ig) +
         doit(i + 1, groups, ig) * groups) %
        mod;
  return ret;
}
int main() {
  scanf("%d", &n);
  memset(dp, -1, sizeof dp);
  cout << doit(0, 0, 0) << endl;
  return 0;
}
