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()))

print((((2+N-k)*(6+N+N**2+2*k+k*N-k**2*2)//6)%(10**9+7)))
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()))
print(
    (((2 + N - k) * (6 + N + N**2 + 2 * k + k * N - k**2 * 2) // 6) % (10**9 + 7))
)

-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())) +print( +    (((2 + N - k) * (6 + N + N**2 + 2 * k + k * N - k**2 * 2) // 6) % (10**9 + 7)) +)