#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long a, b;
  cin >> a >> b;
  vector<int> v;
  long long k = 0;
  for (int i = 1; i <= a; i++) {
    k = (k + (i * b) + 1) % 1000000007;
  }
  long long sum = 0;
  sum = (sum + (b * (b - 1) / 2)) % 1000000007;
  sum = (sum * k) % 1000000007;
  cout << sum % 1000000007;
  return 0;
}
