#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb(x) push_back(x)
#define MAXN 100005
#define cout2(x, y) cout << x << " " << y << endl;

#define MOD 1000000007
using namespace std;

int main(){

    long long a, b;
    while(cin>>a>>b){
        
        
        long long ans = 0, aux;
        
        for(int r = 1; r < b; r++){
        
            aux = (a * (a + 1)/2)%MOD;
            aux = (aux * b)%MOD;
            
            aux = ((aux + a )* r)%MOD;
            ans = (ans + aux)%MOD; 

        }
    
        cout << ans << endl;    
    }

}