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

mod = 10**9+7

ans = 0

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

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

    ans %= mod

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

mod = 10**9+7

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

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

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