#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long getans(int a, int b, long long m) {
  long long sum = (m * ((a * 1LL * (a + 1) / 2) % mod)) % mod;
  sum = (sum * b) % mod;
  sum = (sum + m * a) % mod;
  return sum;
}
int main() {
  int a, b;
  cin >> a >> b;
  long long res = 0;
  for (int i = 1; i < b; i++) {
    res = (res + getans(a, b, i)) % mod;
  }
  cout << res << endl;
}
