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