#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b, ret = 0;
  cin >> a >> b;
  for (long long i = 1; i < b; i++) {
    (ret += 1ll * (1ll * (1ll * a * (a + 1) / 2 % mod) * i % mod) * b % mod) %=
        mod;
    (ret += 1ll * a * i % mod) %= mod;
  }
  cout << ret;
  return 0;
}
