#include <bits/stdc++.h>
using namespace std;
template <class T>
void renew_min(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
void renew_max(T &a, T b) {
  if (b > a) a = b;
}
int main() {
  long long a, b, ans = 0LL;
  cin >> a >> b;
  long long sum = (1 + a) * a / 2;
  sum %= 1000000007;
  for (long long i = 1; i < b; ++i) {
    long long t = i * sum;
    t %= 1000000007;
    ans += t * b + i * a;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
