//BISMILLAHIRRAHMANIRRAHIM
/*
manus tar shopner soman boro
Author :: Shakil Ahmed
.............AUST_CSE27.........
prob ::
Type ::
verdict::
*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define ss second
#define re return
#define QI queue<int>
#define SI stack<int>
#define SZ(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))
double const EPS=3e-8;
using namespace std;
#define FI freopen ("input.txt", "r", stdin)
#define FO freopen ("output.txt", "w", stdout)
typedef long long Long;
typedef long long int64;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef set<int> si;
typedef vector<Long>vl;
typedef pair<int,int>pii;
typedef pair<string,int>psi;
typedef pair<Long,Long>pll;
typedef pair<double,double>pdd;
typedef vector<pii> vpii;
// For loop
#define forab(i, a, b) for (__typeof (b) i = (a) ; i <= b ; ++i)
#define rep(i, n) forab (i, 0, (n) - 1)
#define For(i, n) forab (i, 1, n)
#define rofba(i, a, b) for (__typeof (b)i = (b) ; i >= a ; --i)
#define per(i, n) rofba (i, 0, (n) - 1)
#define rof(i, n) rofba (i, 1, n)
#define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={2,1,-1,-2,-1,1};int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
/* ************************************** My code start here ****************************************** */
const Long mod = 1000000007 ;
Long a , b ;
long long BigMod(long long a,long long b,long long m)
{
if(b==0) return 1;
long long x=BigMod(a,b/2,m);
x=(x*x)%m;
if(b%2)
x=(x*a)%m;
return x;
}
long long ModInverse(long long a,long long m)
{
return BigMod(a,m-2,m);
}
Long cal(Long first , Long n )
{
Long x , y , res ;
x = (( first + first ) % mod + ((( n - 1 )%mod) * b ) % mod ) % mod ;
res = (( n % mod ) * x )%mod ;
res = ((res * ModInverse(2,mod) )%mod + mod)%mod;
return res ;
}
int main()
{
//ios_base::sync_with_stdio(0); cin.tie(0);
cin >> a >> b ;
Long ans = 0 ;
Long first = b + 1 ;
for ( int i = 1 ; i < b ; i++ )
{
Long n = ( a * i ) ;
ans = ( ans + cal(first,n) + mod + mod ) % mod ;
first += ( b + 1 ) ;
first = (first + mod ) % mod ;
}
cout << ( ans + mod + mod ) % mod << endl ;
return 0;
}
CiAvL0JJU01JTExBSElSUkFITUFOSVJSQUhJTQovKgogbWFudXMgdGFyIHNob3BuZXIgc29tYW4gYm9ybwogQXV0aG9yIDo6IFNoYWtpbCBBaG1lZAouLi4uLi4uLi4uLi4uQVVTVF9DU0UyNy4uLi4uLi4uLgogcHJvYiAgIDo6CiBUeXBlICAgOjoKIHZlcmRpY3Q6OgogKi8KCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIG1wIG1ha2VfcGFpcgojZGVmaW5lIHBpIGFjb3MoLTEuMCkKI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIHJlIHJldHVybgojZGVmaW5lIFFJIHF1ZXVlPGludD4KI2RlZmluZSBTSSBzdGFjazxpbnQ+CiNkZWZpbmUgU1ooe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F9O2ludCBkeVtdPXswLDEsMSwwLC0xLC0xfTsgLy9IZXhhZ29uYWwgRGlyZWN0aW9uCgovKiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAgTXkgY29kZSBzdGFydCBoZXJlICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLwpjb25zdCBMb25nIG1vZCA9IDEwMDAwMDAwMDcgOwpMb25nIGEgLCBiIDsKbG9uZyBsb25nIEJpZ01vZChsb25nIGxvbmcgYSxsb25nIGxvbmcgYixsb25nIGxvbmcgbSkKewogICAgICAgaWYoYj09MCkgcmV0dXJuIDE7CiAgICAgICBsb25nIGxvbmcgeD1CaWdNb2QoYSxiLzIsbSk7CiAgICAgICB4PSh4KngpJW07CiAgICAgICBpZihiJTIpCiAgICAgICB4PSh4KmEpJW07CiAgICAgICByZXR1cm4geDsKfQpsb25nIGxvbmcgTW9kSW52ZXJzZShsb25nIGxvbmcgYSxsb25nIGxvbmcgbSkKewogICAgICAgcmV0dXJuIEJpZ01vZChhLG0tMixtKTsKfQoKTG9uZyBjYWwoTG9uZyBmaXJzdCAsIExvbmcgbiApCnsKICAgIExvbmcgeCAsIHkgLCByZXMgOwogICAgeCA9ICgoIGZpcnN0ICsgZmlyc3QgKSAlIG1vZCArICgoKCBuIC0gMSApJW1vZCkgKiBiICkgJSBtb2QgKSAlIG1vZCA7CgoKICAgIHJlcyA9ICgoICBuICUgbW9kICkgICogeCApJW1vZCA7CgogICAgcmVzID0gKChyZXMgKiBNb2RJbnZlcnNlKDIsbW9kKSApJW1vZCArIG1vZCklbW9kOwogICAgcmV0dXJuIHJlcyA7Cn0KaW50IG1haW4oKQp7CiAgICAvL2lvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7IGNpbi50aWUoMCk7CiAgICBjaW4gPj4gYSA+PiBiIDsKCgogICAgIExvbmcgYW5zID0gMCA7CiAgICAgTG9uZyBmaXJzdCAgPSBiICsgMSA7CiAgICAgZ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