#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int mx = 4005;
int a[mx][mx];
int main() {
  int n, i, k, j;
  scanf("%d", &n);
  a[1][0] = a[1][1] = 1;
  for (i = 2; i <= n + 1; i++) {
    a[i][1] = a[i - 1][i - 1];
    for (j = 2; j <= i; ++j) a[i][j] = (a[i - 1][j - 1] + a[i][j - 1]) % mod;
  }
  printf("%d\n", a[n + 1][n]);
}
