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