#include using namespace std; typedef long long ll; const int mod = 1e9 + 7; ll a,b; int main() { scanf("%lld %lld",&a,&b); ll ans = 0; ans += ((a + 1ll) % mod * (b + 1ll) % mod) % mod + (a % mod * b % mod) % mod; ans %= mod; if(a - b & 1) ans -= 1ll; printf("%lld\n",ans); return 0; }