#include <bits/stdc++.h>
using namespace std;
long long dp[10000];
int c[4003][4004];
long long p[4003];
long long n, ans = 1;
long long m = 1000000007;
int main() {
  long long i, j, k;
  scanf("%I64d", &n);
  c[1][0] = c[1][1] = 1;
  c[2][0] = c[2][2] = 1;
  c[2][1] = 2;
  for (i = 3; i <= n; i++) {
    c[i][0] = 1;
    for (j = 1; j <= i; j++) {
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % m;
    }
  }
  p[0] = p[1] = 1;
  p[2] = 2;
  p[3] = 5;
  for (i = 4; i <= n; i++) {
    for (j = 0; j < i; j++) p[i] = (p[i] + (long long)c[i - 1][j] * p[j]) % m;
  }
  for (i = 1; i < n; i++) ans = (ans + c[n][i] * p[i]) % m;
  printf("%I64d\n", ans);
  return 0;
}
