#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;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBhbGwoeCkgeC5iZWdpbigpLCB4LmVuZCgpCiNkZWZpbmUgcGIoeCkgcHVzaF9iYWNrKHgpCiNkZWZpbmUgTUFYTiAxMDAwMDUKI2RlZmluZSBjb3V0Mih4LCB5KSBjb3V0IDw8IHggPDwgIiAiIDw8IHkgPDwgZW5kbDsKCiNkZWZpbmUgTU9EIDEwMDAwMDAwMDcKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CgogICAgbG9uZyBsb25nIGEsIGI7CiAgICB3aGlsZShjaW4+PmE+PmIpewogICAgICAgIAogICAgICAgIAogICAgICAgIGxvbmcgbG9uZyBhbnMgPSAwLCBhdXg7CiAgICAgICAgCiAgICAgICAgZm9yKGludCByID0gMTsgciA8IGI7IHIrKyl7CiAgICAgICAgCiAgICAgICAgICAgIGF1eCA9IChhICogKGEgKyAxKS8yKSVNT0Q7CiAgICAgICAgICAgIGF1eCA9IChhdXggKiBiKSVNT0Q7CiAgICAgICAgICAgIAogICAgICAgICAgICBhdXggPSAoKGF1eCArIGEgKSogciklTU9EOwogICAgICAgICAgICBhbnMgPSAoYW5zICsgYXV4KSVNT0Q7IAoKICAgICAgICB9CiAgICAKICAgICAgICBjb3V0IDw8IGFucyA8PCBlbmRsOyAgICAKICAgIH0KCn0=