// TEMPLATE - START
// ----------------------------------------------------
// DEFINES - START
#include <bits/stdc++.h>
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
// Strings
#define nl "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define yn(x)            \
    if (x)               \
        cout << "YES\n"; \
    else                 \
        cout << "NO\n";
#define yns(x, s1, s2)      \
    if (x)                  \
        cout << s1 << "\n"; \
    else                    \
        cout << s2 << "\n";
#define fail(cond) \
    if (cond)      \
    {              \
        NO;        \
        return;    \
    }
#define success(cond) \
    if (cond)         \
    {                 \
        YES;          \
        return;       \
    }
// Types
#define ll long long
#define ull unsigned long long
#define vl vector<ll>
#define pll pair<ll, ll>
#define vpll vector<pair<ll, ll>>
#define all(x) (x).begin(), (x).end()
// Loops
#define lp(i, a, b) for (int i = (a); i < (b); i++)
#define rlp(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define readlp(arr, n) \
    lp(i, 0, n) cin >> arr[i];
#define writelp(arr, n)                \
    lp(i, 0, n) cout << arr[i] << " "; \
    cout << nl;
#define vv    \
    ll n;     \
    cin >> n; \
    vl v(n);  \
    readlp(v, v.size());
// DEFINES - END
// ----------------------------------------------------
using namespace std;
// ----------------------------------------------------
// ALGORITHMS - START
// Binary Search Custom:
// To Find...,Logical Condition,If Condition is Met...,Return Value
// Lower Bound (First element ≥x),arr[m] >= x,r = m,r
// Upper Bound (First element >x),arr[m] > x,r = m,r
// Last element <x,arr[m] < x,l = m,l
// Last element ≤x,arr[m] <= x,l = m,l

int lowerBound(vector<ll> &v, ll x)
{
    int l = -1, r = v.size();
    while (r > l + 1)
    {
        int m = l + (r - l) / 2;
        ll curr = v[m];
        if (curr >= x)
            r = m;
        else
            l = m;
    }
    return r;
}
// ALGORITHMS - END
// ----------------------------------------------------
// TEMPLATE END

// ====================================================

// Boody's Code
// 2026-07-30, 21:35:44
// CSES - CSES Problem Set
// Sum of Divisors
// https://c...content-available-to-author-only...s.fi/problemset/task/1082
// Time limit: 00, Memory limit: 1
// status:
// Time taken:

// ----------------------------------------------------

ll mod = 1000000007;
ll modmul(ll a, ll b)
{
    return (((a % mod) * (b % mod)) % mod);
}

void solve()
{
    ll n, inv2 = (mod + 1) / 2;
    cin >> n;
    ll sum = (n - 1 + modmul(modmul(n, (n + 1)), inv2)) % mod, a, b, c;
    for (ll i = 2; i * i <= n; i++)
    {
        a = n / i, b = modmul(modmul(a, (a + 1)), inv2), c = modmul(modmul(i, (i + 1)), inv2);
        sum += (modmul(a - i + 1, i) + ((b - c + mod) % mod)) % mod, sum %= mod;
    }
    cout << sum << nl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("/home/rodex/rubuntu/CS/CP/input.txt", "r", stdin);
    freopen("/home/rodex/rubuntu/CS/CP/output.txt", "w", stdout);
#endif
    FAST;

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
}