#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
int C[4005][4005], dp[4005][4005];
void calc(int &x, int y) {
  x += y;
  if (x > Mod) x -= Mod;
}
int main() {
  int n, ans = 1;
  scanf("%d", &n);
  C[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j < i; j++)
      calc(C[i][j], (C[i - 1][j - 1] + C[i - 1][j]) % Mod);
    C[i][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    dp[i][1] = 1;
    for (int j = 1; j < i; j++)
      dp[i][j] = (dp[i - 1][j - 1] + 1LL * dp[i - 1][j] * j % Mod) % Mod;
    dp[i][i] = 1;
  }
  for (int i = 1; i < n; i++) {
    int sum = 0;
    for (int j = 1; j <= i; j++) calc(sum, dp[i][j]);
    calc(ans, 1LL * sum * C[n][i] % Mod);
  }
  printf("%d\n", ans);
  return 0;
}
