#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7;
vector<int> cd[N], p[N];
int add(int x, int y) {
  int ret = (x + y) % mod;
  if (ret < 0) {
    ret += mod;
  }
  return ret;
}
int mul(int x, int y) {
  long long r = x;
  r = r * y % mod;
  return r;
}
int myPow(int x, int c) {
  int ret = 1;
  while (c > 0) {
    if (c & 1) {
      ret = mul(ret, x);
    }
    x = mul(x, x);
    c /= 2;
  }
  return ret;
}
int mInverse;
int dp[N];
int getNumberOfCoprime(int k, int x) {
  int ret = k;
  int sz = p[x].size();
  int lim = (1 << sz);
  int i, bit, bitCount, val;
  for (bit = 1; bit < lim; ++bit) {
    bitCount = 0;
    val = 1;
    for (i = 0; i < sz; ++i) {
      if (bit & (1 << i)) {
        val *= p[x][i];
        ++bitCount;
      }
    }
    if (bitCount & 1) {
      ret -= k / val;
    } else {
      ret += k / val;
    }
  }
  return ret;
}
void solve() {
  int m;
  scanf("%d", &m);
  for (int i = 2; i <= m; ++i) {
    for (int j = i + i; j <= m; j += i) {
      cd[j].push_back(i);
    }
    if (p[i].size() == 0) {
      for (int j = i; j <= m; j += i) {
        p[j].push_back(i);
      }
    }
  }
  mInverse = myPow(m, mod - 2);
  dp[1] = 1;
  int nx;
  int ret = 1;
  for (int i = 2; i <= m; ++i) {
    int x = 1;
    x = add(x, mul(mInverse, getNumberOfCoprime(m, i)));
    for (int j = 0; j < cd[i].size(); ++j) {
      x = add(x, mul(mul(mInverse, dp[cd[i][j]]),
                     getNumberOfCoprime(m / cd[i][j], i / cd[i][j])));
    }
    nx = m / i;
    nx = myPow(m - nx, mod - 2);
    nx = mul(nx, m);
    dp[i] = mul(nx, x);
    ret = add(ret, dp[i]);
  }
  ret = mul(ret, mInverse);
  printf("%d\n", ret);
}
int main() { solve(); }
