MOD = 10**9 + 7



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

s = 0

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

	s = (s + N*k - k*k + k + 1) % MOD

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

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

N, K = list(map(int, input().split()))
print(
    (
        (
            ((N + 1) * (N + 2 - K) * (K + N + 1)) // 2
            - ((N + 1) * (N + 2) * (2 * N + 3)) // 6
            + (K * (K - 1) * (2 * K - 1)) // 6
            + N
            + 2
            - K
        )
        % (10**9 + 7)
    )
)

-MOD = 10**9 + 7 -s = 0 -for k in range(K, N + 2): -    s = (s + N * k - k * k + k + 1) % MOD -print(s) +print( +    ( +        ( +            ((N + 1) * (N + 2 - K) * (K + N + 1)) // 2 +            - ((N + 1) * (N + 2) * (2 * N + 3)) // 6 +            + (K * (K - 1) * (2 * K - 1)) // 6 +            + N +            + 2 +            - K +        ) +        % (10**9 + 7) +    ) +)