n, k = list(map(int, input().split()))

p = 10**9 + 7

cnt = 0

for i in range(k, n + 2):

    cnt += (i * (n - (i - 1)) + 1) % p

print((cnt % p))
n, k = list(map(int, input().split()))

cnt = 0

for i in range(k, n + 2):

    cnt += i * (n - i + 1) + 1

print((cnt % (10**9 + 7)))
n, k = list(map(int, input().split()))
p = 10**9 + 7
cnt = 0
for i in range(k, n + 2):
    cnt += (i * (n - (i - 1)) + 1) % p
print((cnt % p))

n, k = list(map(int, input().split()))
cnt = 0
for i in range(k, n + 2):
    cnt += i * (n - i + 1) + 1
print((cnt % (10**9 + 7)))

-p = 10**9 + 7 -    cnt += (i * (n - (i - 1)) + 1) % p -print((cnt % p)) +    cnt += i * (n - i + 1) + 1 +print((cnt % (10**9 + 7)))