#include <bits/stdc++.h>
using namespace std;
long long a, b, ans;
const int MOD = 1e9 + 7;
int main() {
  cin >> a >> b;
  long long t1 = b * (b - 1) / 2 % MOD;
  long long t2 = (a + b * (a * (a + 1) / 2 % MOD) % MOD) % MOD;
  ans = t1 * t2 % MOD;
  cout << ans << endl;
  return 0;
}
