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