#include <bits/stdc++.h>
using namespace std;
const int B = 1e9 + 7;
int a, b;
int main() {
  scanf("%d%d", &a, &b);
  printf("%d\n", ((long long)b * (b - 1) / 2) % B *
                     (((long long)(a + 1) * a / 2) % B * b % B + a) % B);
  return 0;
}
