#include <bits/stdc++.h>
using namespace std;
long long DP[4009][4009], DP2[4009];
long long power(int x, long long a) {
  long long ans = 1, y = x;
  int index = 1;
  while (a) {
    if (a & 1) {
      ans = ans * y;
      if (ans > 1000000007LL) ans = ans % 1000000007LL;
    }
    y = y * y;
    if (y > 1000000007LL) y = y % 1000000007LL;
    index++;
    a >>= 1;
  }
  return ans;
}
long long inversemod(int x) { return power(x, 1000000007LL - 2); }
int main() {
  long long n;
  cin >> n;
  DP[1][1] = 1;
  DP[1][2] = 0;
  for (long long i = 0; i <= n; i++) DP[i][0] = 0;
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= i; j++) {
      DP[i][j] = (DP[i - 1][j] * j + DP[i - 1][j - 1]) % 1000000007LL;
    }
    DP[i][i + 1] = 0;
  }
  DP2[0] = 1;
  for (long long i = 1; i <= n; i++) {
    long long sum = 0;
    for (long long j = 1; j <= i; j++) {
      sum += DP[i][j];
    }
    sum = sum % 1000000007LL;
    DP2[i] = sum;
  }
  long long ans = 0, k = 1, m = n, d = 1;
  for (long long i = 0; i < n; i++) {
    ans += k * DP2[i];
    ans = ans % 1000000007LL;
    k = (((k * m) % 1000000007LL) * inversemod(d)) % 1000000007LL;
    m--;
    d++;
  }
  ans = ans % 1000000007LL;
  cout << ans;
}
