#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 77, Mod = 1000000007;
int x, y;
int A, B;
int main() {
  scanf("%d %d", &x, &y);
  A = (x * 1ll * (x + 1) / 2) % Mod;
  A = (x + A * 1ll * y) % Mod;
  B = y * 1ll * (y - 1) / 2 % Mod;
  printf("%d\n", A * 1ll * B % Mod);
  return 0;
}
