#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int a, b;
int cheng(int x, int y) {
  long long res = x;
  res *= y;
  res %= MOD;
  return res;
}
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int la, lb;
  if (a & 1)
    la = cheng(a, a / 2 + 1);
  else
    la = cheng(a / 2, a + 1);
  if (b & 1)
    lb = cheng(b, b / 2);
  else
    lb = cheng(b / 2, b - 1);
  int res = cheng(lb, a);
  res += cheng(cheng(la, lb), b);
  res %= MOD;
  printf("%d\n", res);
  return 0;
}
