#include <bits/stdc++.h>
using namespace std;
using namespace std;
bool debug = 0;
void run();
int main() {
  int st = clock();
  run();
  int en = clock();
  freopen("CON", "w", stdout);
  return 0;
}
int a, b;
long long s(long long n) { return (((n) * (n + 1)) / 2) % 1000000007; }
void run() {
  scanf("%d %d", &a, &b);
  long long sum = ((((b * s(a)) % 1000000007) * s(b - 1)) % 1000000007 +
                   (s(b - 1) * a) % 1000000007) %
                  1000000007;
  printf("%I64d ", sum);
  printf("\n");
}
