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

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

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