#include <bits/stdc++.h>
using namespace std;
int mo = 1e9 + 7;
int dp[100005];
int m;
vector<int> divisor[100005];
int multiple[100005];
int primes[100005];
int f[100005];
int mu[100005];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int expo(int a, int b) {
  if (b == 0) return 1;
  if (b == 1) return a % mo;
  int half = expo(a, b / 2);
  half = (1LL * half * half) % mo;
  if (b & 1) half = (1LL * half * a) % mo;
  return half;
}
int expect(int n) {
  if (n == 1) return 0;
  if (dp[n] != -1) return dp[n];
  int &ans = dp[n];
  ans = 0;
  map<int, int> cnt;
  int cntn = 0;
  for (auto y : divisor[n]) {
    int a = n / y;
    int b = m / y;
    int temp = 0;
    for (auto da : divisor[a]) {
      temp += mu[da] * (b / da);
    }
    if (y == n)
      cntn = temp;
    else
      cnt[y] += temp;
  }
  int denom = m - cntn;
  int nume = cntn % mo;
  for (auto it : cnt) {
    nume += (it.second * 1LL * ((expect(it.first) + 1) % mo)) % mo;
    nume %= mo;
  }
  ans = (1LL * nume * expo(denom, mo - 2)) % mo;
  return ans;
}
int main() {
  memset(mu, -1, sizeof(mu));
  memset(dp, -1, sizeof(dp));
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) primes[i] = mu[i] = 1;
  primes[1] = 0;
  for (int i = 2; i <= m; i++) {
    if (primes[i]) {
      for (int j = i * 2; j <= m; j += i) primes[j] = 0;
      for (int j = i; j <= m; j += i) {
        if ((j / i) % i == 0) {
          mu[j] = 0;
        } else {
          mu[j] *= -1;
        }
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        divisor[i].push_back(j);
        if (i / j != j) divisor[i].push_back(i / j);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    ans += (expect(i) + 1) % mo;
    ans %= mo;
  }
  ans = (ans * 1LL * expo(m, mo - 2)) % mo;
  printf("%d\n", ans);
  return 0;
}
