#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using tpl = tuple<int, int, int>;
using pcc = pair<char, char>;
const ll inf = 2e18;
const ll mod = 1e9 + 7;
int dr[] = {-1, 0, 1, 0};
int dc[] = {0, 1, 0, -1};
int kr[] = {-1, 1, -2, -2, -1, 1, 2, 2};
int kc[] = {-2, -2, -1, 1, 2, 2, -1, 1};
int dgr[] = {-1, -1, 1, 1};
int dgc[] = {1, -1, -1, 1};
int main() {
  ll a, b;
  cin >> a >> b;
  ll ans = 0, sum = 0;
  sum = b * (b - 1) / 2;
  sum %= mod;
  for (ll k = 1; k <= a; k++) {
    ans +=
        (((((k % mod) * (b % mod)) % mod + 1) % mod) % mod * sum % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
