#include <bits/stdc++.h>
using namespace std;
vector<int> divs[100005], factors[100005];
int m;
const long long mod = 1e9 + 7;
long long dp[100005], ans, invM;
long long inv(long long a) {
  long long b = mod - 2;
  long long rez = 1;
  while (b) {
    if (b & 1) rez = (rez * a) % mod;
    a = (a * a) % mod;
    b = (b >> 1);
  }
  return rez;
}
long long f(int x, int y) {
  long long a = x / y;
  long long lg = factors[a].size();
  long long limit = m / y;
  long long rez = 0;
  for (int mask = 0; mask < (1LL << lg); mask++) {
    long long p = 1;
    long long nr = 0;
    for (int bit = 0; bit < lg; bit++)
      if ((mask >> bit) & 1) {
        p *= factors[a][bit];
        nr++;
      }
    long long num = limit / p;
    if (nr % 2 == 1) {
      rez -= num;
      if (rez < 0) rez += mod;
    } else
      rez = (rez + num) % mod;
  }
  return rez;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> m;
  for (int i = 1; i <= m; i++)
    for (int j = i; j <= m; j += i) divs[j].push_back(i);
  for (int i = 2; i <= m; i++)
    if (factors[i].size() == 0) {
      factors[i].push_back(i);
      for (int j = i * 2; j <= m; j += i) factors[j].push_back(i);
    }
  invM = inv(m);
  dp[1] = 0;
  ans = invM;
  for (int i = 2; i <= m; i++) {
    long long left = 1;
    long long suma = 1;
    for (auto j : divs[i]) {
      long long val = (invM * f(i, j)) % mod;
      if (j == i) {
        left -= val;
        if (left < 0) left += mod;
      } else {
        val = (val * dp[j]) % mod;
        suma = (suma + val) % mod;
      }
    }
    dp[i] = (suma * inv(left)) % mod;
    ans = (ans + (invM * (dp[i] + 1)) % mod) % mod;
  }
  cout << ans;
  return 0;
}
