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