#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL base = 1e9 + 7;
int main() {
  LL a, b;
  cin >> a >> b;
  LL res = 0;
  LL x = ((a * (a + 1) / 2) % base * b) % base;
  LL y = (b * (b - 1) / 2) % base;
  res = (((x + a) % base) * y) % base;
  cout << res << endl;
}
