#include <bits/stdc++.h>
using namespace std;
long long expo(long long a, long long b) {
  if (!b) return 1;
  a %= 1000000007;
  if (b & 1) return a * expo(a * a, b >> 1) % 1000000007;
  return expo(a * a, b >> 1);
}
long long inv_mod(long long x) { return expo(x, 1000000007 - 2); }
long long m, dp[100010];
vector<int> divi[100010], primes, pdivs[100010];
long long solve2(int val, int lim, int id) {
  if (id == pdivs[val].size()) return 0;
  return (lim / pdivs[val][id]) + solve2(val, lim, id + 1) -
         solve2(val, lim / pdivs[val][id], id + 1);
}
long long solve(int g) {
  if (g == 1) return 0;
  long long &x = dp[g];
  if (x != -1) return x;
  x = m;
  for (int d : divi[g])
    if (d < g)
      x = (x + solve(d) * (m / d - solve2(g / d, m / d, 0))) % 1000000007;
  x = (x * inv_mod(m - m / g)) % 1000000007;
  return x;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%lld", &m);
  for (int i = 1; i <= m; i++)
    for (int j = i; j <= m; j += i) divi[j].push_back(i);
  for (int i = 2; i <= m; i++)
    if (divi[i].size() == 2) primes.push_back(i);
  for (int i = 2; i <= m; i++) {
    int x = i;
    for (int j = 0; j < primes.size(); j++) {
      if (primes[j] * primes[j] > x) break;
      if (x % primes[j] == 0) {
        pdivs[i].push_back(primes[j]);
        while (x % primes[j] == 0) x /= primes[j];
      }
    }
    if (x > 1) pdivs[i].push_back(x);
  }
  long long ans = m;
  for (int i = 1; i <= m; i++) {
    ans += solve(i);
    if (ans >= 1000000007) ans -= 1000000007;
  }
  printf("%lld\n", (ans * inv_mod(m)) % 1000000007);
  return 0;
}
