#include <bits/stdc++.h>
using namespace std;
long long n, i, j;
long long C[4001][4001];
long long B[4001];
long long rez;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) C[i][1] = C[i][i] = 1LL;
  for (i = 3; i <= n; i++)
    for (j = 2; j < i; j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j] * j) % 1000000007LL;
  B[0] = 1LL;
  for (i = 1; i <= n; i++) {
    B[i] = 0LL;
    for (j = 1; j <= i; j++) B[i] = (B[i] + C[i][j]) % 1000000007LL;
  }
  for (i = 0; i <= n; i++) C[i][0] = C[i][i] = 1;
  for (i = 2; i <= n; i++)
    for (j = 1; j < i; j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007LL;
  rez = 0LL;
  for (i = 1LL; i <= n; i++) rez = (rez + C[n][i] * B[n - i]) % 1000000007LL;
  cout << rez;
  return 0;
}
