#include using namespace std; using ll = long long; const int MOD = 1e9 + 7; int main(void) { ll A, B; scanf("%lld %lld", &A, &B); A %= MOD; B %= MOD; if (A % 2 == B % 2) printf("%lld\n", (2 * A % MOD * B % MOD + (A + B) % MOD + 1) % MOD); else printf("%lld\n", (2 * A % MOD * B % MOD + (A + B) % MOD) % MOD); return 0; }