#include <bits/stdc++.h>
using namespace std;
void gt(int &a, int b) {
  if (a < b) a = b;
}
string n2s(int a) {
  stringstream ss;
  ss << a;
  return ss.str();
}
long long b[4000 + 1][4000 + 1]{0}, a[4000 + 1]{0}, c[4000 + 1][4000 + 1];
int main() {
  int n;
  long long ans = 0;
  cin >> n;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++) {
      if (j == 0)
        c[i][j] = 1;
      else if (i == 0)
        c[i][j] = 0;
      else
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % 1000000007;
    }
  b[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      b[i][j] = (b[i - 1][j - 1] + b[i - 1][j] * j) % 1000000007;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++) a[i] = (a[i] + b[i][j]) % 1000000007;
  for (int i = 0; i <= n - 1; i++) ans = (ans + a[i] * c[n][i]) % 1000000007;
  cout << ans << endl;
  return 0;
}
