#include using namespace std; long long a, b; const long long M = 1e9 + 7; bool f; int main() { cin >> a >> b; if ((a + b) & 1) f = 1; a %= M; b %= M; if (f) { if (b & 1) swap(a, b); a = (a + M - 1) % M; cout << ((a + 1) * (b + 1) % M + a * b % M + b * 2 % M) % M << endl; } else cout << ((a + 1) * (b + 1) % M + a * b % M) % M << endl; }