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()))

print((((n*(n + 1)*(n + 2) - (k - 1)*k*(3*n - 2*k + 4))//6 + n - k + 2) % (10**9 + 7)))
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()))
print(
    (
        ((n * (n + 1) * (n + 2) - (k - 1) * k * (3 * n - 2 * k + 4)) // 6 + n - k + 2)
        % (10**9 + 7)
    )
)

-cnt = 0 -for i in range(k, n + 2): -    cnt += i * (n - i + 1) + 1 -print((cnt % (10**9 + 7))) +print( +    ( +        ((n * (n + 1) * (n + 2) - (k - 1) * k * (3 * n - 2 * k + 4)) // 6 + n - k + 2) +        % (10**9 + 7) +    ) +)