#include <bits/stdc++.h>
using namespace std;
int a, b;
long long sum, c;
int main() {
  scanf("%d%d", &a, &b);
  if (b == 1)
    printf("0\n");
  else {
    sum = b;
    sum = sum * (sum - 1);
    sum = (sum / 2) % 1000000007;
    sum = (sum * a) % 1000000007;
    c = a;
    c = (c * (a + 1) / 2) % 1000000007;
    for (int i = 1; i < b; i++)
      sum = (sum + ((c * i) % 1000000007) * b) % 1000000007;
    printf("%d\n", sum);
  }
  return 0;
}
