#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  long long sumr = 0;
  long long sumq = 0;
  int tr = 0;
  int tq = 0;
  for (int i = 1; i < b; ++i) {
    ++tr;
    sumr += i;
    sumr %= 1000000007;
  }
  for (int i = 1; i <= a; ++i) {
    ++tq;
    sumq += i;
    sumq %= 1000000007;
  }
  long long ans = 0;
  ans = ((sumr % 1000000007) * ((b * sumq) % 1000000007) % 1000000007);
  for (int i = 1; i <= a; ++i) {
    ans += sumr;
    ans += 1000000007;
    ans %= 1000000007;
  }
  cout << (ans + 1000000007) % 1000000007 << endl;
  return 0;
}
