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

ans = 0

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

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



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



print((int(((N*(N+1)*(N+2) - K*(K-1)*(3*N-2*K+4))/6 + N - K + 2)%1000000007)))
N, K = list(map(int, input().split()))
ans = 0
for i in range(K, N + 2):
    ans += i * (N - i + 1) + 1
print((ans % 1000000007))

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

-ans = 0 -for i in range(K, N + 2): -    ans += i * (N - i + 1) + 1 -print((ans % 1000000007)) +print( +    ( +        int( +            ( +                (N * (N + 1) * (N + 2) - K * (K - 1) * (3 * N - 2 * K + 4)) / 6 +                + N +                - K +                + 2 +            ) +            % 1000000007 +        ) +    ) +)