#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; ans%=mod; ll t=(B/2)%mod; t*=(A%mod); t%=mod; t*=2; t%=mod; ans=(ans+t+10*mod)%mod; t=((B/2)%mod); t*=((A+1)%mod); t%=mod; t*=2; ans=(ans+t+10*mod)%mod; if(B%2==1){ ans+=(2*(A%mod))%mod; ans=(ans+10*mod)%mod; } cout<