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



counter = 0

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

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

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

    counter += (largest - smallest + 1)

    counter %= (10 ** 9 + 7)



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



MOD = 10 ** 9 + 7



counter = 0

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

	counter += (N-k+1) * k + 1

	counter %= MOD



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

N, K = list(map(int, input().split()))
MOD = 10**9 + 7
counter = 0
for k in range(K, N + 2):
    counter += (N - k + 1) * k + 1
    counter %= MOD
print(counter)

+MOD = 10**9 + 7 -for i in range(K, N + 2): -    smallest = (i - 1) * i // 2 -    largest = ((2 * N + 1) - i) * i // 2 -    counter += largest - smallest + 1 -    counter %= 10**9 + 7 +for k in range(K, N + 2): +    counter += (N - k + 1) * k + 1 +    counter %= MOD