#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
int main() {
  int a, b;
  cin >> a >> b;
  long long S = 0;
  for (int e = 1; e < b; e++) {
    long long s1 = ((long long)a * (a + 1) / 2) % INF;
    long long s2 = (s1 * b) % INF;
    s2 = (s2 + a) % INF;
    S = (S + ((s2 * e) % INF)) % INF;
  }
  cout << S;
  return 0;
}
