#include <bits/stdc++.h>
using namespace std;
int MOD = 1000 * 1000 * 1000 + 7;
int add(int a, int b) { return ((a + b) % MOD + MOD) % MOD; }
int mul(int a, int b) { return ((long long)a * b) % MOD; }
int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int r = 1; r < b; r++) {
    if (a & 1) {
      ans = add(ans, mul((a + 1) / 2, mul(a, mul(r, b))));
    } else {
      ans = add(ans, mul(a / 2, mul(a + 1, mul(r, b))));
    }
    ans = add(ans, mul(a, r));
  }
  cout << ans << endl;
  return 0;
}
