#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while ((c = getchar()) == ' ')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
int n, m, i, j, cnt[1000005], np[1000005], dp[1000005], fac[1000005],
    inv[1000005], first[1000005], mod = 1e9 + 7, s, t;
vector<int> e[1000005], p;
vector<pair<int, int> > seq;
int main() {
  read(n);
  fac[0] = fac[1] = inv[1] = first[0] = first[1] = 1;
  for ((i) = (2); (i) <= (n); (i)++) {
    fac[i] = 1ll * fac[i - 1] * i % mod;
    inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
    first[i] = 1ll * first[i - 1] * inv[i] % mod;
  }
  for (((i)) = (1); ((i)) <= ((n)); ((i))++)
    for (j = i * 2; j <= n; j += i) e[i].push_back(j);
  for ((i) = (2); (i) <= (n); (i)++)
    if (!np[i]) {
      p.push_back(i);
      for (__typeof((e[i]).begin()) it = (e[i]).begin(); it != (e[i]).end();
           it++)
        np[*it] = 1;
    }
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    t = i;
    for (j = 0; j < p.size() && p[j] * p[j] <= t; j++) {
      while (t % p[j] == 0) {
        t /= p[j];
        cnt[i]++;
      }
    }
    if (t > 1) cnt[i]++;
    s = max(s, cnt[i]);
  }
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    seq.push_back(make_pair(cnt[i], i));
    if (cnt[i] == s) dp[i] = 1;
  }
  sort(seq.begin(), seq.end(), greater<pair<int, int> >());
  for (__typeof((seq).begin()) it = (seq).begin(); it != (seq).end(); it++)
    if (cnt[it->second] != s) {
      for (__typeof((e[it->second]).begin()) itt = (e[it->second]).begin();
           itt != (e[it->second]).end(); itt++)
        if (cnt[*itt] == cnt[it->second] + 1) {
          if (n / (it->second) > n / (*itt))
            dp[it->second] = (dp[it->second] +
                              1ll * dp[*itt] * (n / (it->second) - n / (*itt)) %
                                  mod * fac[n - n / (*itt) - 1] % mod *
                                  first[0, n - n / (it->second)]) %
                             mod;
        }
    }
  cout << dp[1] << endl;
  return 0;
}
