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



ans = 0

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

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

    min_num = i * (0 + i - 1) // 2

    ans += max_num - min_num + 1



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

ans = (K - N - 2) * (2 * K * K - K * (N + 2) - N * N - N - 6) // 6

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

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

-ans = 0 -for i in range(K, N + 2): -    max_num = i * (N + N + 1 - i) // 2 -    min_num = i * (0 + i - 1) // 2 -    ans += max_num - min_num + 1 +ans = (K - N - 2) * (2 * K * K - K * (N + 2) - N * N - N - 6) // 6