#include <bits/stdc++.h>
using namespace std;
int main() {
  long long r = 0, mod = 1e9 + 7, a, b, i, z, x, y;
  cin >> a >> b;
  for (i = 1; i < b; ++i) {
    r += i * a + b * i % mod * (a * (a + 1) / 2 % mod);
    r %= mod;
  }
  cout << r << endl;
  return 0;
}
