#include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
using namespace std;
int n, S;
long long mu[3000010], F[3000010], ans = 0;
const long long p = 1e9 + 7;
bool np[3000010];
vector<int> pr;
template <class T>
void read(T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch)) fl |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
long long pw(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % p;
    a = a * a % p, b >>= 1;
  }
  return ret;
}
void sieve() {
  mu[1] = 1;
  for (int i = 2; i <= S; i++) {
    if (!np[i]) pr.push_back(i), mu[i] = p - 1;
    for (int j = 0; j < pr.size(); j++) {
      if (i * pr[j] > S) break;
      np[i * pr[j]] = true;
      if (i % pr[j] == 0) break;
      mu[i * pr[j]] = p - mu[i];
    }
  }
  for (int i = 1; i <= S; i++) {
    mu[i] = (mu[i] + mu[i - 1]) % p;
  }
}
long long f(int m) {
  if (m <= S) return mu[m];
  if (F[n / m]) return F[n / m];
  long long ret = 1;
  for (int i = 2, pos; i <= m; i = pos + 1) {
    pos = m / (m / i);
    ret = (ret - 1LL * (pos - i + 1) * f(m / i) % p + p) % p;
  }
  return F[n / m] = ret;
}
int main() {
  read(n), S = max((int)pow(n, 2.0 / 3), 1), sieve();
  for (int i = 2, pos; i <= n; i = pos + 1) {
    pos = n / (n / i);
    ans = (ans + (f(pos) - f(i - 1) + p) * (n / i) % p * pw(n - n / i, p - 2)) %
          p;
  }
  printf("%lld\n", (1 - ans + p) % p);
  return 0;
}
