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

MOD = 10**9 + 7

ans = 0

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

    # iこ えらぶ

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

    ans %= MOD

print(ans)

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

MOD = 10**9 + 7

ans = 0

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

    m = (k*(k-1))//2

    M = (k*(N+N-k+1))//2

    ans += M-m+1



print((ans%MOD))

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

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

-for i in range(K, N + 2): -    # iこ えらぶ -    ans += (N + 1) * N // 2 - (N - i) * (N - i + 1) // 2 - i * (i - 1) // 2 + 1 -    ans %= MOD -print(ans) +for k in range(K, N + 2): +    m = (k * (k - 1)) // 2 +    M = (k * (N + N - k + 1)) // 2 +    ans += M - m + 1 +print((ans % MOD))