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