n,k=list(map(int,input().split()))

ans=0

mod=10**9+7

for i in range(k,n+2):

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

    ans%=mod

print(ans)
n,k=list(map(int,input().split()))

print(((n*(n+1)*(n+2)//6-(3*n-2*k+4)*(k-1)*k//6-k+n+2)%(10**9+7)))
n, k = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(k, n + 2):
    ans += (n - i + 1) * i + 1
    ans %= mod
print(ans)

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

-ans = 0 -mod = 10**9 + 7 -for i in range(k, n + 2): -    ans += (n - i + 1) * i + 1 -    ans %= mod -print(ans) +print( +    ( +        ( +            n * (n + 1) * (n + 2) // 6 +            - (3 * n - 2 * k + 4) * (k - 1) * k // 6 +            - k +            + n +            + 2 +        ) +        % (10**9 + 7) +    ) +)