MOD = 10 ** 9 + 7



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



ans = 0

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

    i %= MOD

    add = -i**2 + i*(n+1) + 1

    add %= MOD

    ans += add



ans %= MOD

print(ans)



MOD = 10 ** 9 + 7



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



ans = 0

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

    add = -i**2 + i*(n+1) + 1

    add %= MOD

    ans += add



ans %= MOD

print(ans)



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

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

-    i %= MOD