#include using namespace std; using ll = long long; const int MOD = 1e9 + 7; struct mint { using ull = unsigned long long; ull a; constexpr mint(const ull x = 0) noexcept : a(x % MOD) {} constexpr mint operator+(const mint rhs) const noexcept { return mint(*this) += rhs; } constexpr mint operator-(const mint rhs) const noexcept { return mint(*this) -= rhs; } constexpr mint operator*(const mint rhs) const noexcept { return mint(*this) *= rhs; } constexpr mint operator/(const mint rhs) const noexcept { return mint(*this) /= rhs; } constexpr mint &operator+=(const mint rhs) noexcept { a += rhs.a; if (a >= MOD) a -= MOD; return *this; } constexpr mint &operator-=(const mint rhs) noexcept { if (a < rhs.a)a += MOD; a -= rhs.a; return *this; } constexpr mint &operator*=(const mint rhs) noexcept { a = a * rhs.a % MOD; return *this; } constexpr mint &operator/=(mint rhs) noexcept { ull exp = MOD - 2; while (exp) { if (exp % 2) *this *= rhs; rhs *= rhs; exp /= 2; } return *this; } constexpr mint pow(const mint &a, ull n) noexcept { if (n == 0) return 1; auto t = pow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; int main(void) { ll A, B; scanf("%lld %lld", &A, &B); mint x = A, y = B; mint ans = x * y * 2 + x + y + 1; if (A % 2 == B % 2) printf("%lld\n", ans.a); else printf("%lld\n", (ans - 1).a); return 0; }