#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  uint32_t a, b;
  cin >> a >> b;
  uint32_t res = 0;
  uint64_t sumB = (uint64_t(b) * (b - 1) / 2) % 1000000007;
  for (uint64_t i = 1; i <= a; ++i) {
    uint64_t val = ((i * b + 1) % 1000000007) * sumB;
    res = (uint32_t)((res + val) % 1000000007);
  }
  cout << res << endl;
  return 0;
}
