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