#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, n;
  cin >> a >> n;
  int tilln = (1LL * n * (n - 1) / 2) % 1000000007,
      tilla = (1LL * a * (a + 1) / 2) % 1000000007;
  cout << ((((((1LL * tilln) % 1000000007) * tilla) % 1000000007) * n) %
               1000000007 +
           (1LL * a * tilln) % 1000000007) %
              1000000007
       << endl;
  return 0;
}
