#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e6 + 5;
long long a, b;
long long MOD(long long x) { return x % mod; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  cin >> a >> b;
  long long cnta = MOD(a * (a + 1) / 2), cntb = MOD(b * (b - 1) / 2);
  cout << MOD(MOD(MOD(cnta * b + a) * cntb));
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
