#include <bits/stdc++.h>
using namespace std;
const int mod = int(1e9) + 7;
long long chen(long long p, long long q) { return p * q % mod; }
int main() {
  int ra, rb;
  scanf("%d%d", &ra, &rb);
  long long a = ra, b = rb;
  long long tmp = a, tmp2 = b;
  if (tmp % 2 == 0)
    tmp = a / 2 * (a + 1);
  else
    tmp = (a + 1) / 2 * a;
  tmp %= mod;
  if (tmp2 % 2 == 0)
    tmp2 = b / 2 * (b - 1);
  else
    tmp2 = (b - 1) / 2 * b;
  tmp2 %= mod;
  long long ans = chen(chen(tmp, b) + a, tmp2);
  printf("%d\n", int(ans));
  return 0;
}
