#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int s1 = 0, s2 = 0;
  for (int r = 1; r < b; r++) s1 = (s1 + r) % 1000000007;
  for (int k = 1; k <= a; k++)
    s2 = ((s2 + 1) % 1000000007 + (k * b) % 1000000007) % 1000000007;
  s1 = (s1 * s2) % 1000000007;
  cout << s1 << endl;
  return 0;
}
