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

ans = 0

p = 10 ** 9 + 7

a = 0

b = 0

for j in range(k):

  a += j

  b += n-j

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

  ans = (ans+b-a+1)%p

  a += i

  b += n-i

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

ans = 0

p = 10 ** 9 + 7

a = 0

b = 0

for j in range(k-1):

  a += j

  b += n-j

for i in range(k-1, n+1):

  a += i

  b += n-i

  ans = (ans+b-a+1)%p

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

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

-for j in range(k): +for j in range(k - 1): -for i in range(k, n + 2): -    ans = (ans + b - a + 1) % p +for i in range(k - 1, n + 1): +    ans = (ans + b - a + 1) % p