#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXM = 1e5;
long long M;
long long E[MAXM + 10];
long long modpow(long long b, long long p) {
  long long res = 1;
  while (p > 0) {
    if (p & 1LL) res = res * b % MOD;
    p >>= 1LL;
    b = b * b % MOD;
  }
  return res;
}
vector<int> divisors[MAXM + 10];
long long mobius[MAXM + 10];
void find_divisors(long long g) {
  for (long long x = 1; x * x <= g; x++) {
    if (g % x) continue;
    divisors[g].push_back(x);
    if (x * x != g) divisors[g].push_back(g / x);
  }
  sort(divisors[g].begin(), divisors[g].end());
  divisors[g].shrink_to_fit();
}
bool isprime(long long g) { return divisors[g].size() == 2; }
int calc_mobius(long long g) {
  int res = 1;
  for (long long x : divisors[g]) {
    if (x > 1 && isprime(x)) res *= -1;
    if (x > 1 && g % (x * x) == 0) {
      return 0;
    }
  }
  return res;
}
void mobius_init() {
  mobius[1] = 1;
  for (int g = 2; g <= M; g++) {
    mobius[g] = calc_mobius(g);
  }
}
long long modinv(long long b) { return modpow(b, MOD - 2); }
long long sum(long long g) {
  long long res = 0;
  for (long long x : divisors[g]) {
    if (x == g) break;
    long long rr = 0;
    for (long long k : divisors[g]) {
      if (x * k > g) break;
      if (g % (x * k)) continue;
      rr += MOD + (M / (x * k)) * mobius[k];
      rr %= MOD;
    }
    rr = E[x] * rr;
    res = (res + rr) % MOD;
  }
  return res;
}
int main() {
  scanf("%lld", &M);
  for (int g = 1; g <= M; g++) {
    find_divisors(g);
  }
  mobius_init();
  E[1] = 1;
  for (int g = 2; g <= M; g++) {
    long long ss = sum(g);
    E[g] = modinv(M - M / g) * (M + ss) % MOD;
  }
  long long res = 0;
  for (int g = 1; g <= M; g++) {
    res = (res + E[g]) % MOD;
  }
  res = res * modinv(M) % MOD;
  printf("%lld\n", res);
}
