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