#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
int n;
long long dp[4005][4005], c[4005][4005];
int main() {
  for (int i = 1; i < 4005; i++) dp[i][1] = dp[i][i] = 1;
  for (int i = 2; i < 4005; i++)
    for (int j = 2; j < i; j++)
      dp[i][j] = (dp[i - 1][j] * j + dp[i - 1][j - 1]) % md;
  for (int i = 1; i < 4005; i++) c[i][0] = c[i][i] = 1;
  for (int i = 2; i < 4005; i++)
    for (int j = 1; j < i; j++) c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % md;
  scanf("%d", &n);
  long long ans = 1;
  for (int i = 1; i < n; i++)
    for (int j = 1; j <= i; j++) ans = (ans + c[n][i] * dp[i][j] % md) % md;
  printf("%I64d\n", ans);
  return 0;
}
