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

ans = 0

mod = 10**9+7

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

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

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

    ans += (_max - _min + 1) % mod

    ans %= mod

print(ans)
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 + 1) * i // 2
    _max = ((N + 1) + (N + 1 - i + 1)) * i // 2
    ans += (_max - _min + 1) % mod
    ans %= mod
print(ans)

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))

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