/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    ll n = 1e9 + 7;
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    map <ll, ll> m;
    for (ll i = b; i <= a+1; i++){
        ans += (a*i - i*(i-1) + 1)%n;
    }
    cout << ans%n;
    return 0;
}


