#include <bits/stdc++.h>
using namespace std;
const long long p = 1e9 + 7;
long long n;
long long c[4020][4020];
long long f[4020][4020];
signed main() {
  scanf("%lld", &n);
  for (long long i = 0; i <= n + 10; i++) c[i][0] = c[i][i] = 1;
  for (long long i = 2; i <= n; i++)
    for (long long j = 1; j < i; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % p;
  f[0][0] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= i; j++)
      f[i][j] = ((f[i - 1][j] * 1ll * j) % p + f[i - 1][j - 1] % p) % p;
  long long ans = 0;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j <= i; j++)
      ans += (f[i][j] * 1ll * c[n][i]) % p, ans %= p;
  printf("%lld", ans);
  return 0;
}
