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