Calculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + ... + n mod m. As the result can be very large, you should print the value modulo 10^9 + 7 (the remainder when divided by 10^9 + 7).

The modulo operator a mod b stands for the remainder after dividing a by b. For example 10 mod 3 = 1.


-----Input-----

The only line contains two integers n, m (1 ≤ n, m ≤ 10^13) — the parameters of the sum.


-----Output-----

Print integer s — the value of the required sum modulo 10^9 + 7.


-----Examples-----
Input
3 4

Output
4

Input
4 4

Output
1

Input
1 1

Output
0

Difficulty: interview

Starter code:

Solutions:
import math
MOD = int( 1e9 + 7 )

N, M = map( int, input().split() )
sn = int( math.sqrt( N ) )

ans = N * M % MOD
for i in range( 1, min( sn, M ) + 1, 1 ):
  ans -= N // i * i

ans %= MOD
if N // ( sn + 1 ) > M:
  exit( print( ans ) )

for f in range( N // ( sn + 1 ), 0, -1 ):
  s = lambda x: x * ( x + 1 ) // 2
  if N // f > M:
    ans -= f * ( s( M ) - s( N // ( f + 1 ) ) )
    break
  ans -= f * ( s( N // f ) - s( N // ( f + 1 ) ) )

ans %= MOD
if ans < 0:
  ans += MOD
print( ans )


import math

n, m = map(int, input().split())
mod = pow(10, 9) + 7
ans = 0
if n < m:
    ans = n * (m - n) % mod
    m = n
ns = int(math.sqrt(n))
x = [0] * ns
f = 1
for i in range(ns):
    if i + 1 > m:
        f = 0
        break
    x[i] = n // (i + 1)
    ans += (n - x[i] * (i + 1))
    ans %= mod
for i in range(ns + 1, max(ns + 1, x[-1] + 1)):
    ans += n % i
    ans %= mod
if f:
    for i in range(ns - 1):
        if x[i + 1] >= m:
            continue
        c = x[i] - x[i + 1]
        ans += ((n - x[i] * (i + 1)) * c + (i + 1) * c * (c - 1) // 2)
        ans %= mod
        if x[i] >= m > x[i + 1]:
            c = x[i] - m
            ans -= ((n - x[i] * (i + 1)) * c + (i + 1) * c * (c - 1) // 2)
            ans %= mod
print(ans)