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

ans=0





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

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

    maxi=i*N-mini

    ans=ans+(maxi-mini+1)

print((ans%(10**9+7)))

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



M=N+1



A=-M*(M+1)*(2*M+1)//6+(N+1)*M*(M+1)//2+M



M=K-1



B=-M*(M+1)*(2*M+1)//6+(N+1)*M*(M+1)//2+M





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

N, K = list(map(int, input().split()))
M = N + 1
A = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M
M = K - 1
B = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M
print(((A - B) % (10**9 + 7)))

-ans = 0 -for i in range(K, N + 2): -    mini = i * (i - 1) // 2 -    maxi = i * N - mini -    ans = ans + (maxi - mini + 1) -print((ans % (10**9 + 7))) +M = N + 1 +A = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M +M = K - 1 +B = -M * (M + 1) * (2 * M + 1) // 6 + (N + 1) * M * (M + 1) // 2 + M +print(((A - B) % (10**9 + 7)))