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



ans = 0

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

    maximum = (2 * n - num + 1) * num // 2

    minimum = (num - 1) * num // 2

    ans += maximum - minimum + 1

    

ans = ans % (10**9 + 7)



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



m = n + 1

l = k - 1



ans = m * (m**2 + 5) // 6

ans += l * (2 * l**2 + 3 * l - 5 - 3 * m * (l + 1)) // 6

ans = ans % (10**9 + 7)



print(ans)

n, k = list(map(int, input().split()))
ans = 0
for num in range(k, n + 2):
    maximum = (2 * n - num + 1) * num // 2
    minimum = (num - 1) * num // 2
    ans += maximum - minimum + 1
ans = ans % (10**9 + 7)
print(ans)

n, k = list(map(int, input().split()))
m = n + 1
l = k - 1
ans = m * (m**2 + 5) // 6
ans += l * (2 * l**2 + 3 * l - 5 - 3 * m * (l + 1)) // 6
ans = ans % (10**9 + 7)
print(ans)

-ans = 0 -for num in range(k, n + 2): -    maximum = (2 * n - num + 1) * num // 2 -    minimum = (num - 1) * num // 2 -    ans += maximum - minimum + 1 +m = n + 1 +l = k - 1 +ans = m * (m**2 + 5) // 6 +ans += l * (2 * l**2 + 3 * l - 5 - 3 * m * (l + 1)) // 6