#include <bits/stdc++.h>
using namespace std;
using pil = pair<long long, long long>;
using pii = pair<long long, long long>;
using pid = pair<double, double>;
long long mod = 1e9 + 7;
long long power(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n % 2) res = (res * a) % mod;
    a = (a * a) % mod;
    n /= 2;
  }
  return res;
}
void solve() {
  long long a, b;
  cin >> a >> b;
  long long B = (b * (b - 1) / 2) % mod;
  long long A = ((a * (a + 1) / 2) % mod) * b + a;
  A %= mod;
  long long ans = (A * B) % mod;
  cout << ans << endl;
}
int32_t main() {
  long long t = 1;
  while (t--) {
    solve();
  }
}
