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



def sum_(i, j):

    return (a[i] + a[j]) * (j - i + 1) // 2



a = [i for i in range(N + 1)]

ans = 0

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

    min_ = sum_(0, i - 1)

    max_ = sum_(N - i + 1, N)

    ans += (max_ - min_ + 1)

    ans %= 10 ** 9 + 7

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

ans = 0

INF = 10 ** 9 + 7

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

    mi = i * (i - 1) // 2

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

    ans += ma - mi + 1

    ans %= INF

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


def sum_(i, j):
    return (a[i] + a[j]) * (j - i + 1) // 2


a = [i for i in range(N + 1)]
ans = 0
for i in range(K, N + 2):
    min_ = sum_(0, i - 1)
    max_ = sum_(N - i + 1, N)
    ans += max_ - min_ + 1
    ans %= 10**9 + 7
print(ans)

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

- - -def sum_(i, j): -    return (a[i] + a[j]) * (j - i + 1) // 2 - - -a = [i for i in range(N + 1)] +INF = 10**9 + 7 -    min_ = sum_(0, i - 1) -    max_ = sum_(N - i + 1, N) -    ans += max_ - min_ + 1 -    ans %= 10**9 + 7 +    mi = i * (i - 1) // 2 +    ma = i * (2 * N - i + 1) // 2 +    ans += ma - mi + 1 +    ans %= INF