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