#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline int read() {
  int x = 0;
  int f = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    f |= (ch == '-') ? 1 : 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return f ? -x : x;
}
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
int n;
int prime[maxn];
int lim;
inline void getpri(int n) {
  memset(prime, 0, sizeof(prime));
  for (int i = 2; i <= n; ++i) {
    if (!prime[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0] && i * prime[j] <= n; ++j) {
      prime[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        break;
      }
    }
  }
}
int st[maxn], num = 0;
int st1[maxn], st2[maxn], cnt;
long long fac[maxn], inv[maxn];
long long res = 0;
inline void dfs(int step, int sum) {
  if (sum > n) {
    return;
  }
  if (step == lim - 1) {
    st1[num + 1] = 1;
    for (int i = num; i >= 1; --i) st1[i] = st1[i + 1] * st[num - i + 1];
    int cur = n - n / st1[1];
    cnt = 0;
    st2[++cnt] = n / st1[1];
    long long ans = fac[n - 1];
    for (int i = 2; i <= num; ++i) {
      int tmp1 = (n / st1[i]) - (n / st1[i - 1]);
      st2[++cnt] = tmp1;
      ans = ans * tmp1 % mod;
      ans = ans * inv[cur] % mod;
      cur -= tmp1;
    }
    res = (res + ans) % mod;
    return;
  }
  for (int i = 1; i <= 3; ++i) {
    st[++num] = prime[i];
    dfs(step + 1, sum * prime[i]);
    --num;
  }
}
int main() {
  n = read();
  prime[1] = 2;
  prime[2] = 3;
  prime[3] = 5;
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = (long long)fac[i - 1] * i % mod;
  inv[1] = 1;
  for (int i = 2; i <= n; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
  lim = log2(n) + 1;
  dfs(0, 1);
  printf("%lld", res);
}
