#include <bits/stdc++.h>
using namespace std;
long long a, b, v, ans;
int main() {
  cin >> a >> b;
  for (int i = 1; i <= a; i++) {
    v = b - 1ll;
    if (v % 2 == 0)
      ans =
          (ans + (i * ((((b * (v / 2ll)) % (long long)(1e9 + 7)) * (v + 1ll)) %
                       (long long)(1e9 + 7)))) %
          (long long)(1e9 + 7) % (long long)(1e9 + 7);
    else
      ans =
          (ans + (i * ((((b * ((v + 1ll) / 2ll)) % (long long)(1e9 + 7)) * v) %
                       (long long)(1e9 + 7))) %
                     (long long)(1e9 + 7)) %
          (long long)(1e9 + 7);
    ans = (ans + (((b - 1ll) * b / 2ll)) % (long long)(1e9 + 7)) %
          (long long)(1e9 + 7);
  }
  cout << ans << endl;
  return 0;
}
