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

ans=0

mod=10**9+7

b=[0]+[i for i in range(n+1)]

for i in range(1,n+2):

    b[i]+=b[i-1]



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

    ans+=b[n+1]-b[n-i+1]-b[i]+1

    ans%=mod

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

ans=0

mod=10**9+7

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

    ans+=(2*n-i+1)*i//2-i*(i-1)//2+1

    ans%=mod

print(ans)
n, k = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
b = [0] + [i for i in range(n + 1)]
for i in range(1, n + 2):
    b[i] += b[i - 1]
for i in range(k, n + 2):
    ans += b[n + 1] - b[n - i + 1] - b[i] + 1
    ans %= mod
print(ans)

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

-b = [0] + [i for i in range(n + 1)] -for i in range(1, n + 2): -    b[i] += b[i - 1] -    ans += b[n + 1] - b[n - i + 1] - b[i] + 1 +    ans += (2 * n - i + 1) * i // 2 - i * (i - 1) // 2 + 1