#include <bits/stdc++.h>
const int mod = 1e9 + 7;
bool prime[100005] = {0};
int len = 0, isp[100005], divi[50];
long long f[100005];
int n;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long po(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ret;
}
long long calc(int x, int d) {
  x /= d;
  int m = n / d;
  int p = 0, ld = 0;
  while (x != 1) {
    ++p;
    if (x % isp[p] == 0) divi[++ld] = isp[p];
    while (x % isp[p] == 0) x /= isp[p];
  }
  long long ret = 0;
  for (int i = 1; i < (1 << ld); i++) {
    int k = 1, has = 0;
    for (int j = 1; j <= ld; j++)
      if (i & (1 << (j - 1))) has++, k *= divi[j];
    if (has & 1)
      ret += m / k;
    else
      ret -= m / k;
  }
  ret = m - ret;
  return ret;
}
void pre() {
  for (int i = 2; i <= 100000; i++)
    if (prime[i] == 0) {
      isp[++len] = i;
      for (int j = i + i; j <= 100000; j += i) prime[j] = 1;
    }
}
int main() {
  pre();
  scanf("%d", &n);
  f[1] = 0;
  for (int i = 2; i <= n; i++) {
    int div = n, val = n;
    for (int j = 1; j * j <= i; j++)
      if (i % j == 0) {
        div = (div + calc(i, j) * f[j]) % mod;
        if (i / j == i)
          val -= n / i;
        else if (i / j != j)
          div = (div + calc(i, i / j) * f[i / j]) % mod;
      }
    f[i] = div * po(val, mod - 2) % mod;
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++) ans = (ans + f[i] * po(n, mod - 2)) % mod;
  printf("%lld", ans);
}
