Problem:
Score : 400 points

Problem Statement

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 1

3 2

Sample Output 1

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

Sample Input 2

200000 200001

Sample Output 2

1

We must choose all of the integers, so the sum can take just 1 value.

Sample Input 3

141421 35623

Sample Output 3

220280457

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

/*
 ID: swagchicken1
 PROG:
 LANG: C++11
 */

#include <iostream>
#include <tuple>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <vector>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <cctype>
#include <climits>
#include <chrono>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;

#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)

//#define endl '\n';

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1000000007;

long double PI = 4*atan(1);
long double eps = 1e-12;



int main() {
    //auto start = chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(0);cin.tie(0);
    //ofstream cout("output.txt");
    //ifstream cin("input.txt");
    ll n; cin >> n;
    ll k; cin >> k;
    ll ans = 0;
    for(ll i = k; i < n+2; i++) {
        ans +=  ((n)*(n+1))/2 - ((n - i)*(n+1 - i))/2    -  (i*(i-1))/2 + 1;
        ans %= MOD;
    }
    cout << ans << endl;
    
    
    
    //auto stop = chrono::high_resolution_clock::now();
    //auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
    //cout << duration.count() << endl;
    //cin.close();
    //cout.close();
}