N = int(input())
def sqrt(n):
    x = 1 << (n.bit_length() + 1) // 2
    y = (x + n // x) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x
def ra(k):
    a, b = N // (k + 1) + 1, N // k
    return (2 * N - k * (a + b - 2)) * (b - a + 1) // 2
def calc(a):
    s = 1
    n = N
    while s <= N:
        s *= a
    re = 0
    while s:
        re += n // s
        n %= s
        s //= a
    return re

P = 10 ** 9 + 7
r = sqrt(N - 1) - 1
rr = N // (r + 1)
ans = 0
for i in range(2, rr + 1):
    ans += calc(i)
for i in range(1, r + 1):
    ans += ra(i)
print(ans % P)