#include using namespace std; using ll=long long; int main(){ ll A,B; cin>>A>>B; ll mod=1e9+7; if(A%2==0){ ll ans=A+1; ll t=(B/2)%mod; t*=A; t%=mod; t*=2; t%=mod; ans=(ans+t+10*mod)%mod; t=(B/2)%mod; t*=(A+1); t%=mod; t*=2; ans=(ans+t+10*mod)%mod; if(B%2==1){ ans+=2*A; ans=(ans+10*mod)%mod; } cout<