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