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

ans = 0

MOD = 10**9+7

f = lambda x:x*(x+1)//2

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

    ans += f(N)-f(N-i)-f(i-1)+1

    ans %= MOD

print(ans)

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

MOD = 10**9+7

f = lambda x:x*(x+1)//2

ans = sum(f(N)-f(N-i)-f(i-1)+1 for i in range(K, N+2))%MOD

print(ans)

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

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

-ans = 0 -for i in range(K, N + 2): -    ans += f(N) - f(N - i) - f(i - 1) + 1 -    ans %= MOD +ans = sum(f(N) - f(N - i) - f(i - 1) + 1 for i in range(K, N + 2)) % MOD