#include using namespace std; int main() { int64_t A, B; cin >> A >> B; const int64_t mod = 1000000007; int64_t ans = 0; if(A % 2 == B % 2) { A %= mod; B %= mod; ans += 2 * A * B + A + B + 1; ans %= mod; } else { A %= mod; B %= mod; ans += 2 * A * B + A + B; ans %= mod; } cout << ans << endl; return 0; }