#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 = (2ll * (a % mod) * (b % mod)) + a % mod + b % mod + 1ll; ans %= mod; if((a - b) % 2 != 0) ans --; printf("%lld\n",ans % mod); return 0; }