import itertools

import math

from functools import reduce



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



pattern = 0



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

    min = i * (0 + i - 1) // 2

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

    pattern += max - min + 1

    

pattern %= 10 ** 9 + 7

    

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



pattern = 0



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

    min = (0 + i - 1) // 2 * i

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

    pattern += max - min + 1

    

pattern %= 10 ** 9 + 7



print(pattern)
import itertools
import math
from functools import reduce

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

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

-import itertools -import math -from functools import reduce - -    min = i * (0 + i - 1) // 2 -    max = i * (n + n - i + 1) // 2 +    min = (0 + i - 1) // 2 * i +    max = ((n - i) + (1 + n)) // 2 * i