N, K = list(map(int, input().split()))

MAX = 10 ** 9 + 7

 

res = 0

 

def calc_sum(l, r):

  return ((l+r) * (r-l+1)) // 2

 

for i in range(K, N+2):

  low = calc_sum(0,i-1)

  high = calc_sum(N-i+1,N)

  res = (res + (high-low+1)) % MAX

 

print(res)
N,K = list(map(int,input().split()))

MOD = 10**9+7

res = 0

curmin,curmax = 0, N

mini,maxi = 1, N-1

for i in range(1,N+2):

  if i == N+1:

    # print(1)

    res += 1

  else:

    if i >= K:

      # print(curmin,curmax)

      res = (res + curmax - curmin + 1) % MOD

    curmin += mini

    curmax += maxi

    mini += 1

    maxi -= 1



print((res % MOD))

N, K = list(map(int, input().split()))
MAX = 10**9 + 7
res = 0


def calc_sum(l, r):
    return ((l + r) * (r - l + 1)) // 2


for i in range(K, N + 2):
    low = calc_sum(0, i - 1)
    high = calc_sum(N - i + 1, N)
    res = (res + (high - low + 1)) % MAX
print(res)

N, K = list(map(int, input().split()))
MOD = 10**9 + 7
res = 0
curmin, curmax = 0, N
mini, maxi = 1, N - 1
for i in range(1, N + 2):
    if i == N + 1:
        # print(1)
        res += 1
    else:
        if i >= K:
            # print(curmin,curmax)
            res = (res + curmax - curmin + 1) % MOD
        curmin += mini
        curmax += maxi
        mini += 1
        maxi -= 1
print((res % MOD))

-MAX = 10**9 + 7 +MOD = 10**9 + 7 - - -def calc_sum(l, r): -    return ((l + r) * (r - l + 1)) // 2 - - -for i in range(K, N + 2): -    low = calc_sum(0, i - 1) -    high = calc_sum(N - i + 1, N) -    res = (res + (high - low + 1)) % MAX -print(res) +curmin, curmax = 0, N +mini, maxi = 1, N - 1 +for i in range(1, N + 2): +    if i == N + 1: +        # print(1) +        res += 1 +    else: +        if i >= K: +            # print(curmin,curmax) +            res = (res + curmax - curmin + 1) % MOD +        curmin += mini +        curmax += maxi +        mini += 1 +        maxi -= 1 +print((res % MOD))