#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long pw(long long a, long long n) {
  long long ret = 1;
  while (n) {
    if (n & 1ll) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
inline void solve() {
  int a, b;
  cin >> a >> b;
  long long q = b * 1ll * (b - 1) % mod;
  q = q * pw(2, mod - 2) % mod;
  long long qa = a * 1ll * (a + 1) % mod;
  qa = qa * pw(2, mod - 2) % mod;
  qa = qa * b % mod;
  long long ans = q * (a + qa) % mod;
  cout << ans << endl;
}
int main() {
  int t = 1;
  for (int i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
