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