#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  while (cin >> a >> b) {
    long long sumk = (a * (a + 1) / 2) % (1000000007);
    long long sumb = b * (b - 1) / 2 % (1000000007);
    cout << sumb * (sumk * b % (1000000007) + a) % (1000000007) << endl;
  }
  return 0;
}
