#include <bits/stdc++.h>
using namespace std;
long long dp[4001];
int C[4001][4001];
int main() {
  int n;
  scanf("%d", &n);
  dp[0] = 1;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      if (i == j || j == 0)
        C[i][j] = 1;
      else
        C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007;
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++)
      dp[i] = (dp[i] + dp[j] * C[i - 1][j]) % 1000000007;
  int ans = 0;
  for (int i = 0; i < n; i++) ans = (ans + dp[i] * C[n][i]) % 1000000007;
  printf("%d\n", ans);
  return 0;
}
