import numpy as np



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

#print(n,k)

ary = np.array([i for i in range(n+1)])

cum = np.cumsum(ary)

#print(cum)



ans = 0

for j in range(k,n+1):

    ans += (cum[-1] - cum[-j-1]) - cum[j-1] + 1

    

else:

    ans += 1

    ans %= 10**9+7



print(ans)
import numpy as np



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



ary = np.array([i for i in range(n+1)])

#print(ary)



def lr(l,r): # 等差数列の'l'から'r'の和_mean*number

    return (l+r)*(r-l+1)//2



ans = 0

for j in range(k,n+1):

    l = lr(0, j-1)

    r = lr(n+1-j, n)

    ans += r-l+1

    

ans += 1

ans %= 10**9+7



print(ans)

import numpy as np

n, k = list(map(int, input().split()))
# print(n,k)
ary = np.array([i for i in range(n + 1)])
cum = np.cumsum(ary)
# print(cum)
ans = 0
for j in range(k, n + 1):
    ans += (cum[-1] - cum[-j - 1]) - cum[j - 1] + 1
else:
    ans += 1
    ans %= 10**9 + 7
print(ans)

import numpy as np

n, k = list(map(int, input().split()))
ary = np.array([i for i in range(n + 1)])
# print(ary)
def lr(l, r):  # 等差数列の'l'から'r'の和_mean*number
    return (l + r) * (r - l + 1) // 2


ans = 0
for j in range(k, n + 1):
    l = lr(0, j - 1)
    r = lr(n + 1 - j, n)
    ans += r - l + 1
ans += 1
ans %= 10**9 + 7
print(ans)

-# print(n,k) -cum = np.cumsum(ary) -# print(cum) +# print(ary) +def lr(l, r):  # 等差数列の'l'から'r'の和_mean*number +    return (l + r) * (r - l + 1) // 2 + + -    ans += (cum[-1] - cum[-j - 1]) - cum[j - 1] + 1 -else: -    ans += 1 -    ans %= 10**9 + 7 +    l = lr(0, j - 1) +    r = lr(n + 1 - j, n) +    ans += r - l + 1 +ans += 1 +ans %= 10**9 + 7