#include <bits/stdc++.h>
using namespace std;
long long n, res, dpa[4005][4005], s[4005], c[4005][4005];
long long combo(long long x, long long y) {
  if (c[x][y] != 0) return c[x][y];
  if (y == 0 || x == y) return c[x][y] = 1;
  if (x == 0 || x < y) return 0;
  return c[x][y] = (combo(x - 1, y - 1) + combo(x - 1, y)) % 1000000007;
}
int main() {
  cin >> n;
  dpa[0][0] = s[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      dpa[i][j] = dpa[i - 1][j - 1] + dpa[i - 1][j] * j;
      dpa[i][j] %= 1000000007;
      s[i] += dpa[i][j];
      s[i] %= 1000000007;
    }
  }
  for (int i = 0; i < n; i++) {
    res += combo(n, n - i) * s[i];
    res %= 1000000007;
  }
  cout << res;
  return 0;
}
