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