#include using namespace std; int main() { long long A, B; cin >> A >> B; const long long MOD = 1000000000 + 7; int same = 0; if( A % 2 == B % 2 ) same = 1; A %= MOD; B %= MOD; long long ans = A * (B + 1) % MOD + B * (A + 1) % MOD; if( same ) ans = (A + 1) * (B + 1) % MOD + A * B % MOD; ans %= MOD; cout << ans << endl; }