#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  long long a, b;
  cin >> a >> b;
  long long mod = 1000000000 + 7;
  long long x;
  long long c = (a * (a + 1)) / 2;
  c = c % mod;
  c = (c * b) % mod;
  c = (c + a) % mod;
  x = c;
  long long sum = 0;
  for (int i = 1; i < b; ++i) {
    sum += (x * i);
    sum = sum % mod;
  }
  cout << sum;
}
