#include //#include using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) ll mod = 1e9+7; int main() { ll A,B; cin>>A>>B; cout<<(2*(A%mod)*(B%mod)+A+B+((A-B)%2==0))%mod<