#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = 0;
  long long d = (b * (b - 1) / 2) % 1000000007;
  long long c = (a * (a + 1) / 2) % 1000000007;
  ans = (c * b + a) % 1000000007;
  cout << (ans * d) % 1000000007;
}
