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

 

s = 0

 

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

  s += i*N +1 - i*(i -1)



print((s%(10**9 +7)))
N,K = list(map(int,input().split()))

 

s = int( (N*(N+1)*(N+2))/6 - (K*(K-1)*(3*N-2*K+4))/6 + N-K+2 )

 

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

N, K = list(map(int, input().split()))
s = int(
    (N * (N + 1) * (N + 2)) / 6 - (K * (K - 1) * (3 * N - 2 * K + 4)) / 6 + N - K + 2
)
print((s % (10**9 + 7)))

-s = 0 -for i in range(K, N + 2): -    s += i * N + 1 - i * (i - 1) +s = int( +    (N * (N + 1) * (N + 2)) / 6 - (K * (K - 1) * (3 * N - 2 * K + 4)) / 6 + N - K + 2 +)