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