#include <bits/stdc++.h>
using namespace std;
long long a, b;
const long long mod = 1e9 + 7;
long long ans;
long long m;
int main() {
  cin >> a >> b;
  m = (b * (b - 1)) / 2 % mod;
  for (long long k = 1; k <= a; k++) {
    ans = ((ans + k * b + 1)) % mod;
  }
  ans = ans * m % mod;
  printf("%I64d\n", ans);
  return 0;
}
