#include <bits/stdc++.h>
using namespace std;
int m;
long long dp[200013];
long long modpow(long long a, long long b) {
  long long res = 1;
  for (; b > 0; b /= 2) {
    if (b & 1) res = (res * a) % 1000000007LL;
    a = (a * a) % 1000000007LL;
  }
  return res;
}
long long inverse(long long a) { return modpow(a, 1000000007LL - 2); }
map<int, int> primeFactorization[200013];
vector<int> factors[200013];
long long findCount(long long x, long long n) {
  vector<long long> items;
  for (auto it : primeFactorization[n]) {
    if (primeFactorization[x].find(it.first) == primeFactorization[x].end()) {
      items.push_back(it.first);
    } else if (it.second != primeFactorization[x][it.first]) {
      items.push_back(it.first);
    }
  }
  long long answer = m / x;
  for (int i = 1; i < (1 << items.size()); i++) {
    long long sign = 1;
    long long prod = 1;
    for (int j = 0; j < items.size(); j++) {
      if (i & (1 << j)) {
        prod *= items[j];
        sign *= -1;
      }
    }
    answer += sign * ((m / x) / prod);
  }
  return answer;
}
long long inverseM;
long long solve(int pos) {
  if (dp[pos] != -1) return dp[pos];
  if (pos == 1) return 1;
  long long rhs = 1;
  for (int i : factors[pos]) {
    if (i == pos) continue;
    rhs += (((findCount(i, pos) * solve(i)) % 1000000007LL) * inverseM) %
           1000000007LL;
    rhs %= 1000000007LL;
  }
  dp[pos] =
      (((rhs * m) % 1000000007LL) * inverse(m - (m / pos))) % 1000000007LL;
  return dp[pos];
}
void factorize(int n) {
  int original = n;
  factors[original].push_back(1);
  for (int i = 2; i <= sqrt(original) + 10; i++) {
    int count = 0;
    while (n % i == 0) {
      count++;
      n /= i;
    }
    if (count != 0) primeFactorization[original][i] = count;
    int prevSize = factors[original].size();
    int curpow = i;
    for (int j = 0; j < count; j++) {
      for (int k = 0; k < prevSize; k++) {
        factors[original].push_back(factors[original][k] * curpow);
      }
      curpow *= i;
    }
  }
  if (n != 1) {
    primeFactorization[original][n]++;
    int prevSize = factors[original].size();
    for (int k = 0; k < prevSize; k++) {
      factors[original].push_back(factors[original][k] * n);
    }
  }
}
int main() {
  if (fopen("FILENAME.in", "r")) {
    freopen("FILENAME.in", "r", stdin);
    freopen("FILENAME.out", "w", stdout);
  }
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> m;
  for (int i = 2; i <= m; i++) {
    factorize(i);
  }
  for (int i = 1; i <= m; i++) {
    dp[i] = -1;
  }
  inverseM = inverse(m);
  long long answer = 0;
  for (int i = m; i >= 1; i--) {
    answer += inverseM * solve(i);
    answer %= 1000000007LL;
  }
  cout << answer << endl;
}
