#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  long long a, b, k, x, i, div, ans(0);
  cin >> a >> b;
  for (x = 1; x < b; x++) {
    ans = (ans + a * x + (((a * (1 + a) / 2) % mod * x) % mod) * b) % mod;
  }
  cout << ans;
}
