typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll a,b; std::cin >> a>>b; const ll MOD = 1e9+7; a%=MOD; b%=MOD; std::cout << (2*a%MOD*b%MOD+a+b+(a%2==b%2))%MOD << std::endl; }