## https://yukicoder.me/problems/no/1276 import math MOD = 10 ** 9 + 7 def main(): N = int(input()) sqrt_n = int(math.sqrt(N)) # B <= sqrt_nのケースを考える answer1 = 0 for b in range(1, sqrt_n + 1): c_num = N // b - 1 sqrt_b = int(math.sqrt(b)) a_num = 0 for a in range(1, sqrt_b + 1): if b % a == 0: a_ = b // a a_num += 1 if a_ != a: a_num += 1 a_num = N - N // b - (a_num - 1) ans_num = (c_num * a_num) % MOD answer1 += ans_num answer1 %= MOD # B > sqrt_nのケースを考える array = [] for r in range(2, sqrt_n + 2): upper = N // r lower = (N // (r + 1)) + 1 if upper <= sqrt_n: break lower = max(sqrt_n + 1, lower) array.append((lower, upper, r)) answer2 = 0 for lower, upper, r in array: total = (upper - lower + 1) total *= N total %= MOD total *= (r - 1) total %= MOD # 倍数を引く tot = (r * (upper - lower + 1)) % MOD tot *= (r - 1) tot %= MOD total -= tot total %= MOD # あらかじめ1は引いておく tot = ((r - 1) * (upper - lower + 1)) % MOD total -= tot total %= MOD sqrt_upper = int(math.sqrt(upper)) for p in range(2, sqrt_upper + 1): p2 = p * (p + 1) if p2 > upper: c = 0 if lower <= p ** 2: c += 1 else: lower2 = min(upper, max(p2, lower)) u1 = upper // p l1 = (lower2 - 1) // p b = 0 if lower <= p ** 2: b += 1 a = 2 * (u1 - l1) c = (a + b) % MOD c *= (r - 1) c %= MOD total -= c total %= MOD answer2 += total answer2 %= MOD answer = (answer1 + answer2) % MOD print(answer) def main2(): N = int(input()) # B <= sqrt_nのケースを考える answer1 = 0 for b in range(1, N + 1): c_num = N // b - 1 sqrt_b = int(math.sqrt(b)) a_num = 0 for a in range(1, sqrt_b + 1): if b % a == 0: a_ = b // a a_num += 1 if a_ != a: a_num += 1 a_num = N - N // b - (a_num - 1) ans_num = (c_num * a_num) % MOD answer1 += ans_num answer1 %= MOD print(answer1) if __name__ == "__main__": main()