#include <bits/stdc++.h>
int dp[4000 + 5], ncr[4000 + 5][4000 + 5];
int main() {
  int n, i, j, ans;
  long long p;
  scanf("%d", &n);
  ncr[0][0] = 1;
  for (i = 1; i <= n; i++) {
    ncr[i][0] = 1;
    for (j = 1; j <= i; j++) {
      p = ((long long)ncr[i - 1][j - 1] + ncr[i - 1][j]) % 1000000007LL;
      ncr[i][j] = p;
    }
  }
  dp[0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j < i; j++) {
      p = ((long long)dp[i] + (long long)ncr[i - 1][j] * dp[i - j - 1]) %
          1000000007LL;
      dp[i] = p;
    }
  }
  ans = 0;
  for (i = 0; i < n; i++) {
    p = ((long long)ans + (long long)ncr[n][i] * dp[i]) % 1000000007LL;
    ans = p;
  }
  printf("%d\n", ans);
  return 0;
}
