#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
int mul(int x, int y) { return (long long)x * y % mod; }
int fe(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = mul(res, x);
    x = mul(x, x);
    k >>= 1;
  }
  return res;
}
const int N = 1e5 + 5;
int n;
int dp[N], hm[N];
vector<int> dv[N];
bool stress = 0;
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    for (int j = i + i; j <= n; j += i) dv[j].push_back(i);
  }
  int inv_n = fe(n, mod - 2);
  dp[1] = 0;
  auto gcd = [&](int a, int b) {
    while (b) {
      a %= b;
      swap(a, b);
    }
    return a;
  };
  for (int i = 2; i <= n; i++) {
    dp[i] = 1;
    reverse(dv[i].begin(), dv[i].end());
    int for_one = n;
    for (auto d : dv[i]) {
      hm[d] = n / d - n / i;
      for (auto k : dv[i / d]) {
        if (k * d >= i) break;
        hm[d] -= hm[d * k];
      }
      for_one = add(for_one, mod - hm[d]);
      dp[i] = add(dp[i], mul(mul(hm[d], dp[d]), inv_n));
    }
    int p = n / i;
    dp[i] = mul(dp[i], n);
    dp[i] = mul(dp[i], fe(n - p, mod - 2));
    if (stress) {
      int dp_p = 1, cnt = 0;
      for (int j = 1; j <= n; j++) {
        int g = gcd(i, j);
        if (g != i) {
          dp_p = add(dp_p, mul(dp[g], inv_n));
        } else
          cnt++;
      }
      assert(cnt == n / i);
      dp_p = mul(dp_p, n);
      dp_p = mul(dp_p, fe(n - cnt, mod - 2));
      assert(dp_p == dp[i]);
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = add(ans, dp[i]);
  }
  ans = mul(ans, inv_n);
  ans = add(ans, 1);
  printf("%d\n", ans);
  return 0;
}
