#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool fs(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
int main() {
  long long int a, b, ans = 0, x, y, z;
  fs(a);
  fs(b);
  for (long long int i = 1; i <= a; i++) {
    x = ((b * (b - 1)) / 2) % 1000000007;
    y = (i * b + 1) % 1000000007;
    ans = ((ans % 1000000007) + ((x * y) % 1000000007)) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
