a,b=list(map(int,input().split()))

wa=lambda a,b:(a+b)*(b-a+1)//2

print((sum([wa(a+2-i,a+1)-wa(0,i)+1for i in range(b,a+2)])%(10**9+7)))
from math import comb as c

a,b=list(map(int,input().split()))

print((((c(a+2,2)+1)*(a+2-b)-c(a+3-b,3)-c(a+3,3)+c(b+1,3))%(10**9+7)))
a, b = list(map(int, input().split()))
wa = lambda a, b: (a + b) * (b - a + 1) // 2
print(
    (
        sum([wa(a + 2 - i, a + 1) - wa(0, i) + 1 for i in range(b, a + 2)])
        % (10**9 + 7)
    )
)

from math import comb as c

a, b = list(map(int, input().split()))
print(
    (
        ((c(a + 2, 2) + 1) * (a + 2 - b) - c(a + 3 - b, 3) - c(a + 3, 3) + c(b + 1, 3))
        % (10**9 + 7)
    )
)

+from math import comb as c + -wa = lambda a, b: (a + b) * (b - a + 1) // 2 -        sum([wa(a + 2 - i, a + 1) - wa(0, i) + 1 for i in range(b, a + 2)]) +        ((c(a + 2, 2) + 1) * (a + 2 - b) - c(a + 3 - b, 3) - c(a + 3, 3) + c(b + 1, 3))