#include <bits/stdc++.h>
using namespace std;
long long a, b, mod, sumz, sumy, sum, last, first, kol, z;
long long run(long long x, long long step) {
  long long res = 1;
  while (step) {
    if (step & 1) res = (res * x) % mod;
    x = x * x % mod;
    step >>= 1;
  }
  return res % mod;
}
int main() {
  cin >> a >> b;
  mod = 1000 * 1000 * 1000 + 7;
  sumz = (a * b) % mod;
  sumz = (sumz * (b - 1)) % mod;
  sumz = (sumz * run(2, mod - 2)) % mod;
  sumy = (a * (a + 1)) % mod;
  sumy = (sumy * b) % mod;
  sumy = (sumy * (b - 1)) % mod;
  sumy = (sumy * run(4, mod - 2)) % mod;
  sum = ((b * sumy) % mod + sumz) % mod;
  cout << sum << endl;
  return 0;
}
