#include <bits/stdc++.h>
using namespace std;
const int xkj = 1000000007;
int mu[100010], prime[100010], tot;
int m, f[100010], sb[100010];
bool vis[100010];
vector<int> son[100010];
int qpow(int x, int y) {
  int res = 1;
  while (y > 0) {
    if (y & 1) res = res * (long long)x % xkj;
    x = x * (long long)x % xkj;
    y >>= 1;
  }
  return res;
}
int main() {
  scanf("%d", &m);
  for (int i = 2; i <= m; i++) {
    if (vis[i] == false) {
      prime[++tot] = i;
      mu[i] = -1;
    }
    for (int j = 1; j <= tot && i * prime[j] <= m; j++) {
      vis[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
      mu[i * prime[j]] = -mu[i];
    }
  }
  for (int i = 1; i <= m; i++) {
    if (mu[i] < 0) mu[i] += xkj;
    for (int j = i; j <= m; j += i) {
      son[j].push_back(i);
    }
  }
  for (int i = 2; i <= m; i++) {
    for (vector<int>::iterator j = son[i].begin(); j != son[i].end(); j++) {
      sb[i] = (sb[i] + f[*j] * (long long)mu[i / *j]) % xkj;
    }
    for (vector<int>::iterator j = son[i].begin(); j != son[i].end(); j++) {
      f[i] = (f[i] + (m / *j) * (long long)sb[*j]) % xkj;
    }
    f[i] = f[i] * (long long)qpow(m, xkj - 2) % xkj;
    f[i] = (f[i] + 1) % xkj;
    int ss = qpow(m, xkj - 2) * (long long)(m / i) % xkj;
    ss = (1 + xkj - ss) % xkj;
    f[i] = f[i] * (long long)qpow(ss, xkj - 2) % xkj;
    sb[i] = (sb[i] + f[i]) % xkj;
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) ans = (ans + f[i]) % xkj;
  printf("%d\n", (1 + ans * (long long)qpow(m, xkj - 2) % xkj) % xkj);
  return 0;
}
