MOD=(10**9)+7

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

ans=0

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

    min_start=0

    min_end=min_start+i-1

    max_end=n

    max_start=n-i+1

    min_sum=(min_end-min_start+1)*(min_end+min_start)//2

    max_sum=(max_end-max_start+1)*(max_end+max_start)//2

#    print(i,min_start,min_end,min_sum,max_start,max_end,max_sum,max_sum-min_sum+1)

    ans+=max_sum-min_sum+1

    ans=ans%MOD

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

MOD=(10**9)+7



ans=0

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

    min_sum=i*(i-1)//2

    max_sum=i*(n+(n-i+1))//2

#    print(i,min_sum,max_sum,max_sum-min_sum+1)

    ans=(ans+(max_sum-min_sum+1))%MOD

print(ans)
MOD = (10**9) + 7
n, k = list(map(int, input().split()))
ans = 0
for i in range(k, n + 2):
    min_start = 0
    min_end = min_start + i - 1
    max_end = n
    max_start = n - i + 1
    min_sum = (min_end - min_start + 1) * (min_end + min_start) // 2
    max_sum = (max_end - max_start + 1) * (max_end + max_start) // 2
    #    print(i,min_start,min_end,min_sum,max_start,max_end,max_sum,max_sum-min_sum+1)
    ans += max_sum - min_sum + 1
    ans = ans % MOD
print((ans % MOD))

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

+n, k = list(map(int, input().split())) -n, k = list(map(int, input().split())) -    min_start = 0 -    min_end = min_start + i - 1 -    max_end = n -    max_start = n - i + 1 -    min_sum = (min_end - min_start + 1) * (min_end + min_start) // 2 -    max_sum = (max_end - max_start + 1) * (max_end + max_start) // 2 -    #    print(i,min_start,min_end,min_sum,max_start,max_end,max_sum,max_sum-min_sum+1) -    ans += max_sum - min_sum + 1 -    ans = ans % MOD -print((ans % MOD)) +    min_sum = i * (i - 1) // 2 +    max_sum = i * (n + (n - i + 1)) // 2 +    #    print(i,min_sum,max_sum,max_sum-min_sum+1) +    ans = (ans + (max_sum - min_sum + 1)) % MOD +print(ans)