We have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.
We will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).

-----Constraints-----
 - 1 \leq N \leq 2\times 10^5
 - 1 \leq K \leq N+1
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N K

-----Output-----
Print the number of possible values of the sum, modulo (10^9+7).

-----Sample Input-----
3 2

-----Sample Output-----
10

The sum can take 10 values, as follows:
 - (10^{100})+(10^{100}+1)=2\times 10^{100}+1
 - (10^{100})+(10^{100}+2)=2\times 10^{100}+2
 - (10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\times 10^{100}+3
 - (10^{100}+1)+(10^{100}+3)=2\times 10^{100}+4
 - (10^{100}+2)+(10^{100}+3)=2\times 10^{100}+5
 - (10^{100})+(10^{100}+1)+(10^{100}+2)=3\times 10^{100}+3
 - (10^{100})+(10^{100}+1)+(10^{100}+3)=3\times 10^{100}+4
 - (10^{100})+(10^{100}+2)+(10^{100}+3)=3\times 10^{100}+5
 - (10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\times 10^{100}+6
 - (10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\times 10^{100}+6

Difficulty: MEDIUM_HARD

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


(n, k) = map(int, input().split())
ans = 0
for i in range(k, n + 2):
	ans += (n - i + 1) * i + 1
print(ans % 1000000007)


(n, k) = list(map(int, input().split()))
s = 0
for i in range(k, n + 2):
	s += i * (n + n - (i - 1)) // 2 + 1 - i * (i - 1) // 2
print(s % 1000000007)


(N, K) = map(int, input().split())
s = 0
for i in range(K, N + 2):
	s += i * N + 1 - i * (i - 1)
print(s % (10 ** 9 + 7))


(N, K) = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
for k in range(K, N + 2):
	mx = k * (2 * N - k + 1) / 2
	mi = k * (k - 1) / 2
	add = mx - mi + 1
	ans += add
	ans %= mod
print(int(ans))


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


(N, K) = map(int, input().split())
a = []
ans = 0
for i in range(K, N + 2):
	ans += (N + 1 + N + 2 - i) * i / 2 - (1 + i) * i / 2 + 1
print(int(ans % 1000000007))


import sys
sys.setrecursionlimit(10 ** 7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor

def cmb(n, r, mod):
	bunshi = 1
	bunbo = 1
	for i in range(r):
		bunbo = bunbo * (i + 1) % mod
		bunshi = bunshi * (n - i) % mod
	return bunshi * pow(bunbo, mod - 2, mod) % mod
mod = 10 ** 9 + 7

def I():
	return int(input())

def LI():
	return list(map(int, input().split()))

def MI():
	return list(map(int, input().split()))

def LLI(n):
	return [list(map(int, input().split())) for _ in range(n)]
(n, k) = MI()
ans = 0
for i in range(k, n + 2):
	ans += i * (n - i + 1) % mod + 1
print(ans % mod)


(N, K) = map(int, input().split())
MOD = 10 ** 9 + 7
r = 0
for k in range(K, N + 2):
	r += k * (N - k + 1) + 1
print(r % MOD)


def main():
	(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) % mod
		ans = ans % mod
	print(ans)

def __starting_point():
	main()
__starting_point()


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


(n, k) = map(int, input().split())
total = 0
for l in range(k, n + 2):
	total += l * n - l * (l - 1) + 1
print(total % 1000000007)


(N, K) = [int(_) for _ in input().split()]
s = 0
e = 0
ans = 0
MOD = 10 ** 9 + 7
for i in range(N + 1):
	s += i
	e += N - i
	if i + 1 >= K:
		ans += e - s + 1
		ans %= MOD
print(ans)


(N, K) = map(int, input().split())
M = 10 ** 9 + 7
A = [0 for _ in range(N + 1)]
RA = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
	A[i] = A[i - 1] + i
RA[0] = N
for j in range(1, N + 1):
	RA[j] = N - j + RA[j - 1]
ans = 0
for k in range(K, N + 2):
	minv = A[k - 1]
	maxv = RA[k - 1]
	ans += (maxv - minv + 1) % M
	ans %= M
print(ans)


(N, K) = map(int, input().split())
ans = 0
for p in range(K, N + 2):
	ans = ans + p * N - p * (p - 1) + 1
print(ans % (10 ** 9 + 7))


(n, k) = map(int, input().split())
ans = 0
while k <= n + 1:
	ans += k * (n - k + 1) + 1
	k += 1
print(ans % (10 ** 9 + 7))


(n, k) = map(int, input().split())
count = 0
for i in range(k, n + 2):
	count = (count + i * (n - i + 1) + 1) % (1000000000.0 + 7)
print(int(count))


(n, k) = map(int, input().split())
mod = 10 ** 9 + 7
inv = pow(2, mod - 2, mod=mod)

def calc(b, e, c):
	nonlocal mod
	nonlocal inv
	res = (e + b) % mod
	res = res * c % mod * inv
	return res % mod
ans = 0
for i in range(k, n + 2):
	min_val = calc(0, i - 1, i)
	max_val = calc(n - i + 1, n, i)
	ans += (max_val - min_val + 1) % mod
	ans %= mod
print(ans)


po = pow(10, 9) + 7
(n, k) = map(int, input().split())
cc = 0
for i in range(k, n + 2):
	cc += (n * i - i * (i - 1) + 1) % po
print(cc % po)


(N, K) = map(int, input().split())
x = 0
while K <= N + 1:
	x += K * N - K ** 2 + K + 1
	K += 1
print(x % 1000000007)


(N, K) = map(int, input().split())
s = 0
while K <= N + 1:
	s += (K * (N - K + 1) + 1) % (10 ** 9 + 7)
	s %= 10 ** 9 + 7
	K += 1
print(s)


(N, K) = map(int, input().split())
mod = 10 ** 9 + 7

def ksum(n):
	return n * (n + 1) // 2
ans = 0
msum = ksum(N)
for i in range(K, N + 2):
	ans += msum - ksum(N - i) - ksum(i - 1) + 1
	ans %= mod
print(ans)


(N, K) = map(int, input().split())
big = 10 ** 9 + 7
ans = 0

def sum2(begin, end):
	return (begin + end) * (end - begin + 1) // 2
for k in range(K, N + 2):
	ans += (sum2(N + 1 - k + 1, N + 1) - sum2(1, k) + 1) % big
print(ans % big)


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


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


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


def rui_sum(n, k):
	k_lsum = (k - 1) * k // 2
	k_usum = k * n - (k - 1) * k // 2
	return k_usum - k_lsum + 1
(n, k) = map(int, input().split())
cnt = []
for i in range(k, n + 2):
	cnt.append(rui_sum(n, i))
print(sum(cnt) % (10 ** 9 + 7))


(N, K) = map(int, input().split())
A = [i for i in range(N + 1)]
mod = 10 ** 9 + 7
ans = 0
head = sum(A[:K - 1]) if K > 1 else 0
tail = sum(A[-K + 1:]) if K > 1 else 0
for i in range(K, N + 2):
	head += A[i - 1]
	tail += A[-i]
	ans += tail - head + 1
	ans = ans % mod
print(ans)


(N, K) = map(int, input().split())
s = 0
for k in range(K, N + 2):
	s += k * (N - k + 1) + 1
print(int(s) % 1000000007)


import sys
from itertools import chain
MOD = 1000000007
OFFSET = 10 ** 100

def k_in_n(k, n):
	minimum = k * (k - 1) // 2
	maximum = k * (2 * n - k + 1) // 2
	return (minimum, maximum)

def solve(N: int, K: int):
	keep = None
	answer = 0
	for k in range(K, N + 2):
		if keep is None:
			keep = k_in_n(k, N)
		else:
			minmax = k_in_n(k, N)
			if minmax[0] + OFFSET <= keep[1]:
				keep[0] -= OFFSET
				keep[1] = minimum[1]
			else:
				answer = (answer + keep[1] - keep[0] + 1) % MOD
				keep = minmax
	if keep is not None:
		answer = (answer + keep[1] - keep[0] + 1) % MOD
	return answer

def main():
	tokens = chain(*(line.split() for line in sys.stdin))
	N = int(next(tokens))
	K = int(next(tokens))
	answer = solve(N, K)
	print(answer)

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
ans = 0
mod = 10 ** 9 + 7
for k in range(K, N + 2):
	ans += max((N - k + 1) * k + 1, 0)
print(ans % mod)


(n, m) = list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = 0
min = 0
max = 0
for k in range(1, n + 2):
	min += k - 1
	max += n - (k - 1)
	if k >= m:
		sum = (sum + max - min + 1) % mod
print(sum)


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


(N, K) = map(int, input().split(' '))
total = 0
for k in range(N + 1, K - 1, -1):
	total += k * N - k * (k - 1) + 1
print(total % (10 ** 9 + 7))


(n, k) = [int(i) for i in input().split()]
s = 0
for i in range(k, n + 2):
	s += n * i - i * (i - 1) + 1
a = s % (10 ** 9 + 7)
print(a)


(a, b) = (int(x) for x in input().split())
z = 0
for i in range(b, a + 2):
	z = (z + (a - i + 1) * i + 1) % int(1000000000.0 + 7)
print(z)


(N, K) = map(int, input().split())
ans = sum([i * N - i * (i - 1) + 1 for i in range(K, N + 2)])
ans %= 1000000007
print(ans)


(N, K) = map(int, input().split())
ans = 0
while K <= N + 1:
	ans += ((N + 1) * (N + 2) - (N - K + 1) * (N - K + 2) - K * (K + 1)) // 2 + 1
	K += 1
print(ans % (10 ** 9 + 7))


(n, k) = map(int, input().split())
M = [n] * (n + 1)
m = [0] * (n + 1)
for i in range(1, n + 1):
	M[i] = M[i - 1] + n - i
	m[i] = m[i - 1] + i
mod = 10 ** 9 + 7
ans = 0
for i in range(k - 1, n + 1):
	tmp = M[i] - m[i] + 1
	ans = (ans + tmp) % mod
ans = ans % mod
print(ans)


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


mod = 1000000007
(n, k) = list(map(int, input().split(' ')))
sum = 0
for i in range(k, n + 2):
	sum = sum + i * (n - i + 1) + 1
print(sum % mod)


(N, K) = [int(x) for x in input().split()]
ans = 0
for k in range(K, N + 2):
	ans = (ans + k * (N - k + 1) + 1) % (10 ** 9 + 7)
print(ans)


(n, k) = map(int, input().split())
sum = 0
MOD = 1000000007
for i in range(k, n + 2):
	sum = sum + i * (n - i + 1) + 1
	sum %= MOD
print(sum)


(n, k) = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
(l, h) = (0, 0)
for x in range(1, n + 2):
	l += x - 1
	h += n - x + 1
	if x >= k:
		ans += h - l + 1
		ans = ans % mod
print(ans)


def main():
	(n, k) = map(int, input().split())
	mod = 10 ** 9 + 7
	cnt = 0
	for i in range(k, n + 2):
		l = (i - 1) * i // 2
		h = (n + n - i + 1) * i // 2
		cnt += h - l + 1
	print(cnt % mod)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
p = 10 ** 9 + 7
s = 0
for c in range(k, n + 2):
	s += (n - c + 1) * c + 1
	s = s % p
print(s)


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


(n, k) = map(int, input().split())
L = list(range(n + 1))
cnt = 0
ans = 0

def calc(i):
	smallest = (i - 1) * i // 2
	largest = (2 * n - i + 1) * i // 2
	return largest - smallest + 1
for i in range(k, n + 2):
	cnt += calc(i)
	cnt %= 10 ** 9 + 7
print(cnt)


def solve():
	(N, K) = [int(i) for i in input().split()]
	ans = 0
	mod = 10 ** 9 + 7
	for M in range(K, N + 2):
		min_sum = (M - 1) * M // 2
		max_sum = (2 * N - (M - 1)) * M // 2
		cnt = max_sum - min_sum + 1
		ans += cnt
		ans %= mod
	print(ans)

def __starting_point():
	solve()
__starting_point()


(N, K) = map(int, input().split())
mod = 10 ** 9 + 7
Ans = 0
for m in range(K, N + 2):
	maxi = m * (N - m + 1 + N) / 2
	mini = m * (0 + m - 1) / 2
	Ans += int(maxi - mini + 1)
	Ans %= mod
print(Ans)


(n, k) = map(int, input().split())
n += 1
p = 0
for i in range(k, n + 1):
	p += i * (n - i) + 1
	p %= 1000000007
print(p)


(N, K) = map(int, input().split())
f = lambda i: i * (i + 1) // 2
print(sum((f(N) - f(N - i) - f(i - 1) + 1 for i in range(K, N + 2))) % (10 ** 9 + 7))


(N, K) = map(int, input().split())
N += 1
s = 0
for i in range(K, N + 1):
	s += (N - i) * i + 1
print(s % 1000000007)


(n, k) = map(int, input().split())
tot = 0
for i in range(k, n + 2):
	tot += n + 2 - i + (i - 1) * (n + 1 - i)
print(str(tot % 1000000007))


(a, b) = map(int, input().split())
c = 0
for i in range(b, a + 2):
	cad = -1 * i * i + i * (a + 1) + 1
	c += cad
print(c % (10 ** 9 + 7))


import math
(N, K) = list(map(int, input().split()))
list1 = list(range(N + 1))
list2 = []
for i in range(K, N + 2):
	min = math.floor(i * (list1[0] + list1[i - 1]) / 2)
	max = math.floor(i * (list1[N - i + 1] + list1[N]) / 2)
	list2.append(max - min + 1)
print(sum(list2) % (10 ** 9 + 7))


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


def main():
	(N, K) = [int(x) for x in input().split(' ')]
	p = 1000000007
	cnt = 0
	for i in range(K, N + 2):
		cnt = (cnt + i * N - i * i + i + 1) % p
	print(cnt)
main()


import bisect, collections, copy, itertools, math, string
import sys

def I():
	return int(sys.stdin.readline().rstrip())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def S():
	return sys.stdin.readline().rstrip()

def LS():
	return list(sys.stdin.readline().rstrip().split())

def main():
	(n, k) = LI()
	N = 10 ** 9 + 7
	ans = 0
	start = sum([i for i in range(0, k - 1)])
	goal = sum([i for i in range(n, n - k + 1, -1)])
	for (i, j) in zip(range(k - 1, n + 1), range(n - k + 1, -1, -1)):
		start += i
		goal += j
		cnt = (goal - start + 1) % N
		ans += cnt
		ans %= N
	print(ans)
main()


(n, k) = map(int, input().split())
b = 0
for i in range(k, n + 2):
	x = 0.5 * i * (i - 1)
	b += i * n - 2 * x + 1
print(int(b % (10 ** 9 + 7)))


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


def main():
	(N, K) = list(map(int, input().split()))
	mod = 7 + 10 ** 9
	res = 0
	for k in range(K, N + 2):
		res += k * (2 * N - k + 1) / 2 - k * (k - 1) / 2 + 1
		res %= mod
	print(int(res))

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
mod = 1000000007
ans = 0
for i in range(k, n + 2):
	minSum = i * (i - 1) // 2
	maxSum = i * (2 * n - i + 1) // 2
	ans += maxSum - minSum + 1
	ans %= mod
print(ans)


(a, b) = (int(x) for x in input().split())
z = 0
for i in range(b, a + 2):
	z = (z + (a - i + 1) * i + 1) % (10 ** 9 + 7)
print(z)


(n, k) = (int(x) for x in input().split())
p = 1000000007
s = 0
for i in range(k, n + 2):
	s = s + i * (n + 1 - i) + 1
print(s % p)


S = 0
(a, b) = map(int, input().split())
for N in range(b, a + 2):
	S += (a - N + 1) * N + 1
print(S % (10 ** 9 + 7))


def main():
	(N, K) = map(int, input().split())
	N = N + 1
	A = [n for n in range(N)]
	S = [0] * (N + 1)
	for a in A:
		S[a + 1] += S[a] + a
	ans = 0
	for k in range(K, N + 1):
		(maxS, minS) = (S[-1], S[k])
		offset = S[-k - 1]
		ans += maxS - offset - minS + 1
	print(ans % 1000000007)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
mod = 10 ** 9 + 7
print(sum(((n * l - l * (l - 1) + 1) % mod for l in range(k, n + 2))) % mod)


from itertools import accumulate
(n, k) = list(map(int, input().split()))
cumsum = list(accumulate(range(n + 1)))
cumsum_r = list(accumulate(range(n + 1)[::-1]))
MOD = 10 ** 9 + 7
ans = 0
for i in range(k, n + 2):
	(_min, _max) = (cumsum[i - 1], cumsum_r[i - 1])
	ans = (ans + _max - _min + 1) % MOD
print(ans)


MODINT = 1000000007
(n, k) = map(int, input().split())
prod = [0] * (n + 1)
for i in range(1, n + 1):
	prod[i] = prod[i - 1] + i
ans = 0
for s in range(k - 1, n + 1):
	L = prod[s]
	R = prod[n] - prod[n - s] + (n - s)
	ans += R - L + 1
	ans %= MODINT
print(ans)


(N, K) = map(int, input().split())
MOD = 10 ** 9 + 7
s = [0] * (N + 1)
for i in range(1, N + 1):
	s[i] = s[i - 1] + i
ans = 0
for n in range(K, N + 2):
	mn = s[n - 1] - s[0]
	mx = s[N] - s[max(N - n, 0)]
	count = mx - mn + 1
	ans += count
	ans %= MOD
print(ans)


def resolve():
	(n, k) = map(int, input().split())
	a = 10 ** 9 + 7
	ans = 0
	for K in range(k, n + 2):
		ans += n * K - K ** 2 + K + 1
		ans %= a
	print(ans)
resolve()


(N, K) = map(int, input().split())
start = sum(range(K))
end = sum(range(N - K + 1, N + 1))
count = 0
for k in range(K, N + 2):
	count += end - start + 1
	count %= 1000000007
	start += k
	end += N - k
print(count)


(a, b) = (int(x) for x in input().split())
z = 0
while b <= a + 1:
	z = (z + (a - b + 1) * b + 1) % (10 ** 9 + 7)
	b += 1
print(z)


import sys
input = sys.stdin.readline
mod = 1000000007

def ST():
	return input().rstrip()

def I():
	return int(input())

def MI():
	return list(map(int, input().split()))

def LI():
	return list(MI())
(N, K) = MI()
MAX = sum(range(N - K + 2, N + 1))
MIN = sum(range(0, K - 1))
ans = 0
for k in range(K, N + 2):
	MAX += N - k + 1
	MIN += k - 1
	ans += (MAX - MIN + 1) % mod
print(ans % mod)


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

def sub_sum(l, r):
	return (l + r) * (r - l + 1) / 2
ans = 0
for i in range(K, N + 2):
	l = sub_sum(0, i - 1)
	r = sub_sum(N - i + 1, N)
	ans += r - l + 1
ans = ans % (10 ** 9 + 7)
print(int(ans))


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


a = input().split(' ')
N = int(a[0])
K = int(a[1])
sum = 0
for i in range(K, N + 2):
	sum += i * (N + 1 - i) + 1
print(sum % (10 ** 9 + 7))


def main():
	from itertools import accumulate
	import sys
	input = sys.stdin.readline
	(n, k) = list(map(int, input().split()))
	mod = 10 ** 9 + 7
	a = list(accumulate([0] + [i for i in range(n + 1)]))
	ans = 0
	for j in range(k, n + 2):
		max_value = a[-1] - a[n + 1 - j]
		min_value = a[j]
		ans += max_value - min_value + 1
		ans %= mod
	print(ans % mod)

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
div = 10 ** 9 + 7
count = 0
for k in range(K, N + 2):
	count += (N - k + 1) * k + 1
print(count % div)


(N, K) = map(int, input().split())
min_val = 0
max_val = 0
for i in range(K):
	max_val += N - i
	min_val += i
ans = 0
mod = 10 ** 9 + 7
for i in range(K, N + 2):
	ans += max_val - min_val + 1
	ans %= mod
	min_val += i
	max_val += N - i
print(ans)


(a, b) = (int(x) for x in input().split())
z = 0
while b <= a + 1:
	z = (z + (a - b + 1) * b + 1) % int(1000000000.0 + 7)
	b += 1
print(z)


(n, k) = [int(s) for s in input().split()]
sum = 0
for i in range(k, n + 2):
	sum += i * (n - i + 1) + 1
print(int(sum % (1000000000.0 + 7)))


def sm(i):
	tmpp = 0
	for j in range(i):
		tmpp += j
	return (tmpp, j)

def bi(i, N):
	tmpp = 0
	for j in range(i):
		tmpp += N - j
	return (tmpp, N - j)

def main():
	(N, K) = list(map(int, input().split()))
	ans = 0
	for i in range(K, N + 2, 1):
		if i == K:
			(small, numsmall) = sm(i)
			(big, numbig) = bi(i, N)
		else:
			small += numsmall + 1
			numsmall += 1
			big += numbig - 1
			numbig -= 1
		ans += big - small + 1
	return ans % (10 ** 9 + 7)
print(main())


(N, K) = map(int, input().split())
lis = []
for k in range(K, N + 2):
	lis.append((N - k + 1) * k + 1)
print(sum(lis) % (10 ** 9 + 7))


(N, K) = list(map(int, input().split()))
x = 10
y = 10 + N
ans = 0
a = x
b = y
for i in range(1, N + 2):
	if i >= K:
		ans += b - a + 1
	a += x + i
	b += y - i
print(ans % (10 ** 9 + 7))


p = 10 ** 9 + 7
(N, K) = map(int, input().split())
cnt = 0
for i in range(N + 1 - K + 1):
	cnt = (cnt + (K + i) * (N - K - i + 1) + 1) % p
print(cnt)


(N, K) = list(map(int, input().split()))
p = 10 ** 9 + 7
(L_min, L_max) = (0, 0)
for i in range(K - 1, N + 1):
	L_min += i * (i + 1) // 2 - 1
	L_max += N * (N + 1) // 2 - (N - i - 1) * (N - i) // 2
ans = (L_max - L_min) % p
print(ans)


(N, K) = map(int, input().split())
print(sum(((N + 1 - n) * n + 1 for n in range(K, N + 2))) % (10 ** 9 + 7))