#include <bits/stdc++.h>
using namespace std;
int a, b;
long long fastExp(long long a, long long b) {
  long long res = 1;
  long long pot = a;
  while (b) {
    if (b & 1) res = (res * pot) % 1000000007;
    b >>= 1;
    pot = (pot * pot) % 1000000007;
  }
  return res;
}
int main() {
  while (scanf("%d %d", &a, &b) == 2) {
    long long res = a;
    long long p1 =
        ((((long long)b * (a + 1)) % 1000000007 * fastExp(2, 1000000007 - 2)) %
             1000000007 +
         1) %
        1000000007;
    long long p2 =
        (((long long)b * (b - 1)) % 1000000007 * fastExp(2, 1000000007 - 2)) %
        1000000007;
    res = ((p1 * a) % 1000000007 * p2) % 1000000007;
    cout << res << "\n";
  }
}
