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

ans=0

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

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

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

  ans+=maxs-mins+1

  ans%=10**9+7

  #print('#####')

  #print(i)

  #print(ans)

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

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

mod=pow(10,9)+7

ans=0

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

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

    ans%=mod

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

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

+mod = pow(10, 9) + 7 -    maxs = i * (2 * n - i + 1) // 2 -    mins = i * (i - 1) // 2 -    ans += maxs - mins + 1 -    ans %= 10**9 + 7 -    # print('#####') -    # print(i) -    # print(ans) -print((ans % (10**9 + 7))) +    ans += (i * (n + n - i + 1)) // 2 - (i * (i - 1)) // 2 + 1 +    ans %= mod +print(ans)