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