#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000000 + 7;
int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = 0;
  for (long long r = 1; r < b; ++r) {
    long long tmp = (a * (a + 1) / 2) % mod;
    tmp = (tmp * r) % mod;
    tmp = (tmp * b) % mod;
    tmp = (tmp + (a * r) % mod) % mod;
    ans = (ans + tmp) % mod;
  }
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
