def f(x, b): ret = 0 while x > 0: ret += x % b x //= b return ret p = 10**9 + 7 N = int(input()) ans = 0 L = min(N + 1, 10 ** 6 + 1) for i in range(2, L): ans += f(N, i) ans %= p for a1 in range(1, 10 ** 6): r = min(N, N // a1) l = max(L - 1, N // (1 + a1)) if r - l <= 0: continue ans += (r - l) * a1 % p ans %= p ans += N * (r - l) - a1 * (r - l) * (r + l + 1) // 2 % p ans %= p print(ans)