#include <bits/stdc++.h>
using namespace std;
long long c[4003][4003];
long long b[4003];
int main() {
  for (int i = 0; i < 4003; i++) {
    c[i][0] = 1;
  }
  for (int i = 1; i < 4003; i++) {
    for (int j = 1; j <= i; j++) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      c[i][j] %= 1000000007;
    }
  }
  long long sum = 0;
  b[0] = 1;
  for (int i = 1; i < 4003; i++) {
    sum = 0;
    for (int j = 0; j < i; j++) {
      sum += b[j] * c[i - 1][j];
      sum %= 1000000007;
    }
    b[i] = sum;
  }
  int n;
  cin >> n;
  cout << (b[n + 1] - b[n] + 1000000007) % 1000000007 << endl;
}
