#include <iostream>
#include <string>
#include <sstream>
#include<bits/stdc++.h>
#include<math.h>
#include<algorithm>
#define len(a) ((int) (a).size())
#define ll long long
#define N 100000
#define fr(i,m,n) for(ll i=m;i<=n;i++)
#define f_r(i,m,n) for(ll i=m;i<n;i++)
#define pi acos(-1.0)
#define MAXN 1000000007
#define pf printf


using namespace std;
#define nMX 50000
#define pMX 50000
int pr[pMX+1],prnum[nMX+1];

int sieve()
{
    int i,j;
    for(i=1;i<=nMX;i++)
        prnum[i]=i+1;
    for(i=1;i<=nMX;i++)
        if(prnum[i]!=-1)
            for(j=2*prnum[i]-1;j<=nMX;j+=prnum[i])
                    prnum[j]=-1;
    j=0;
    for(i=1;i<=nMX;i++)
        if(prnum[i]!=-1)
            pr[++j]=prnum[i];
    return j;
}
int f[10000] = {0};
ll fib(ll n)
{
    // Base cases
    if (n == 0)
        return 0;
    if (n == 1 || n == 2)
        return (f[n] = 1);

    // If fib(n) is already computed
    if (f[n])
        return f[n];

    ll k = (n & 1)? (n+1)/2 : n/2;

    // Applyting above formula [Note value n&1 is 1
    // if n is odd, else 0.
    f[n] = (n & 1)? (fib(k)*fib(k) + fib(k-1)*fib(k-1))
           : (2*fib(k-1) + fib(k))*fib(k);

    return f[n];
}
bool prime(ll n)
{
    if (n<2)
        return false;
    for(ll i=2;i*i<=n;i++)
    {
        if (n%i == 0)   return false;
    }

    return true;
}
ll bino(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;  // nC0 is 1

    for (ll i = 1; i <= n; i++)
    {
        // Compute next row of pascal triangle using
        // the previous row
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%1000000007;
    }
    return C[k];
}
bool myComparison(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}


ll  bigmod ( ll a, ll p, ll m )
{
    if ( p == 0 )return 1; // If power is 0, then a ^ 0 = 1 for any value of a, And 1 Mod m=1 for any value of m, So return 1

    if ( p % 2 ) // If power is odd, Split it : a ^ 5 =( a )* (a ^ 4) --> left and right child respectively.
    {
        return ( ( a % m ) * ( bigmod ( a, p - 1, m ) ) ) % m;
    }
    else //If power is even then split it equally and return the result...
    {
        long long c = bigmod ( a, p / 2, m );
        return ( (c%m) * (c%m) ) % m;
    }
}
bool v(char a)
{
    if(a=='a' || a=='e'|| a=='i' || a=='o' || a=='u')
        {return 1;}
        else
            return 0;

}
ll max(ll a, ll b) { return (a > b)? a : b; }
ll min(ll a, ll b) { return (a > b)? b : a; }

int lcs(string a,string b, int m,int n)
{
    int L[m+1][n+1];
    f_r(i,0,m+1)
    {
        f_r(j,0,n+1)
        {
            if(i==0 || j==0)
                L[i][j]=0;
            else if (a[i-1]==b[j-1])
                L[i][j]=L[i-1][j-1]+1;
            else
            L[i][j]=max(L[i-1][j],L[i][j-1]);
           // cout<<i<<" "<<j<<" "<<L[i][j]<<endl;
        }
    }
    return L[m][n];
}
int bsc(int arr[], int n, int key)
{
    int le = 0, ri = n;

    int mid;
    while (le < ri) {
        mid = (ri + le) >> 1;
        if (arr[mid] == key)
            {
            while (mid + 1 < n && arr[mid + 1] == key)
                    mid++;
                    break;
            }

        else if (arr[mid] > key)
            ri = mid;
        else
            le = mid + 1;
    }
    while (mid > -1 && arr[mid] > key)
        mid--;
    return mid + 1;
}

using namespace std;

int main()
{
    ll a,b,j;
    ll m=1000000007;
    cin>>a>>b;
    ll ans=0;
    if(a+1==b)
        cout<<1;
    else
    {
        f_r(i,b,a+2)
        {
            j=0.5*(i*(2*a+1-i)-i*(i-1))+1;
            j=j%m;
            ans=(ans+j)%m;
           // cout<<i<< " "<<j<<" "<<ans<<endl;
        }
     cout<<ans;
    }


}



Measured memory_bytes: 3656