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

div = 10**9 + 7

ans = 0

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

    ans += i + N*i - i**2 + 1

print((ans%div))
N,K = list(map(int, input().split()))

div = 10**9 + 7

ans = 0

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

    ans += p * (N - p + 1) + 1

    

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

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

-for i in range(K, N + 2): -    ans += i + N * i - i**2 + 1 +for p in range(K, N + 2): +    ans += p * (N - p + 1) + 1