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