#include <bits/stdc++.h>
using namespace std;
int N;
const long long mod = 1e9 + 7;
long long S[4005][4005], Ans;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) S[i][1] = 1;
  for (int i = 2; i <= N; i++)
    for (int j = 2; j <= i; j++)
      S[i][j] = (j * S[i - 1][j] % mod + S[i - 1][j - 1]) % mod;
  for (int i = 1; i <= N; i++) Ans = (Ans + S[N][i] * i % mod) % mod;
  printf("%lld", Ans);
  return 0;
}
