#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret;
  scanf("%d", &ret);
  return ret;
}
const int mod = 1000000007;
int main() {
  long long a = read(), b = read();
  long long sum = 0;
  for (int i = 1; i < b; i++) {
    sum += a * i % mod;
    long long temp = a * (a + 1) / 2 % mod;
    sum += i * b % mod * temp % mod;
    sum %= mod;
  }
  printf("%I64d\n", sum);
  return 0;
}
