#include <bits/stdc++.h>
using namespace std;
long long int sum, n, a, b, f, s;
int main() {
  cin >> a >> b;
  f = (a * (a + 1)) / 2;
  f %= 1000000007;
  f *= b;
  f %= 1000000007;
  f += a;
  f %= 1000000007;
  s = (b - 1) * b;
  s /= 2;
  s %= 1000000007;
  sum = f % 1000000007 * s % 1000000007;
  sum %= 1000000007;
  cout << sum << '\n';
  return 0;
}
