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

ans=0

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

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

    ans=(ans+kos)%(10**9+7)

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

ans=0

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

    kos=i*(N-i+1)+1

    ans=(ans+kos)%(10**9+7)

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

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

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