#include <bits/stdc++.h>
using namespace std;
const long long mod7 = 1000000007;
int main() {
  long long n, a, b;
  cin >> a >> b;
  long long sum = 0;
  for (long long i = 1; i < b; ++i) {
    long long fir = (a * (a + 1) / 2) % mod7;
    long long sec = (fir * b) % mod7;
    long long thi = (a + sec) % mod7;
    long long fou = (i * thi) % mod7;
    sum += fou;
    sum %= mod7;
  }
  cout << sum;
  return 0;
}
