#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
vector<long long> divisors(long long x) {
  vector<long long> ret;
  for (long long i = 2; i <= sqrt(x); x++)
    if (!(x % i)) ret.push_back(i);
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  long long res = (b * (b - 1) / 2) % MOD *
                  ((((a * (a + 1) / 2) % MOD) * b) % MOD + a) % MOD;
  cout << res % MOD;
  return 0;
}
