#include <bits/stdc++.h>
using namespace std;
const signed int inf_i32 = 0x6fffffff;
const unsigned int inf_u32 = 0xefffffff;
const signed long long inf_i64 = 0x6fffffffffffffff;
const unsigned long long inf_u64 = 0xefffffffffffffff;
auto main() -> signed int {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  unsigned int n;
  cin >> n;
  vector<unsigned int> bigf(n + 1);
  for (unsigned int i = 1; i <= n; i++) {
    for (unsigned int j = 2 * i; j <= n; j += i) {
      bigf[j] = i;
    }
  }
  vector<map<unsigned int, unsigned int>> prmf(n + 1);
  vector<unsigned int> sump(n + 1);
  unsigned int maxsump = 0;
  for (unsigned int i = 2; i <= n; i++) {
    if (bigf[i] == 1) {
      prmf[i][i] = 1;
      sump[i] = 1;
    } else {
      unsigned int j = bigf[i];
      unsigned int k = i / j;
      for (auto [prm, pwr] : prmf[j]) {
        prmf[i][prm] += pwr;
      }
      for (auto [prm, pwr] : prmf[k]) {
        prmf[i][prm] += pwr;
      }
      for (auto [prm, pwr] : prmf[i]) {
        sump[i] += pwr;
      }
    }
    maxsump = max(sump[i], maxsump);
  }
  vector<unsigned int> v;
  for (unsigned int i = 2; i <= n; i++) {
    if (sump[i] == maxsump) v.push_back(i);
  }
  const unsigned int m = 1e9 + 7;
  vector<unsigned int> fac(n + 1, 1);
  for (unsigned int i = 2; i <= n; i++) {
    fac[i] = fac[i - 1] * i % m;
  }
  vector<map<unsigned int, unsigned long long>> dp(n + 1);
  for (auto u : v) {
    dp[1][u] = 1;
  }
  for (signed int i = 0; i < n; i++) {
    for (auto [u, cnt] : dp[i]) {
      if (n / u - i > 0)
        dp[i + 1][u] = (dp[i + 1][u] + dp[i][u] * (n / u - i) % m) % m;
      for (auto [p, _] : prmf[u]) {
        if (n / u > 0)
          dp[i + 1][u / p] =
              (dp[i + 1][u / p] + dp[i][u] * (n / (u / p) - n / u) % m) % m;
      }
    }
  }
  cout << dp[n][1];
  cout << "\n";
  return 0;
}
