#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int inf = 0x3c3c3c3c;
const long long infl = 0x3c3c3c3c3c3c3c3c;
const int mod = 1e9 + 7;
int main() {
  ll a, b;
  cin >> a >> b;
  ll sum = ((b - 1) * b / 2) % mod;
  ll ans = (sum * a) % mod;
  for (int i = 1; i <= a; i++) {
    ans += (((i * b) % mod) * sum) % mod;
    ans %= mod;
  }
  printf("%lld", ans);
}
