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