N, K = list(map(int, input().split()))

M = 10**9 + 7

ans = 0

for i in range(K, N+2):

    _min = (i-1)*i//2 

    _max =  (N + N-i+1) * i //2 

    ans += (_max - _min + 1) 

print((ans % M))
N, K = list(map(int, input().split()))



ans = 0

mod = 10**9+7

for i in range(K, N+2):

    min = i*(i-1)/2

    max = (2*N-i+1)*i/2

    ans += max - min + 1

print((int(ans%mod)))
N, K = list(map(int, input().split()))
M = 10**9 + 7
ans = 0
for i in range(K, N + 2):
    _min = (i - 1) * i // 2
    _max = (N + N - i + 1) * i // 2
    ans += _max - _min + 1
print((ans % M))

N, K = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(K, N + 2):
    min = i * (i - 1) / 2
    max = (2 * N - i + 1) * i / 2
    ans += max - min + 1
print((int(ans % mod)))

-M = 10**9 + 7 +mod = 10**9 + 7 -    _min = (i - 1) * i // 2 -    _max = (N + N - i + 1) * i // 2 -    ans += _max - _min + 1 -print((ans % M)) +    min = i * (i - 1) / 2 +    max = (2 * N - i + 1) * i / 2 +    ans += max - min + 1 +print((int(ans % mod)))