#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long A, B;
int main() {
  cin >> A >> B;
  long long num1 = (A + ((A * (A + 1) / 2) % MOD) * B) % MOD;
  long long num2 = B * (B - 1) / 2 % MOD;
  cout << num1 * num2 % MOD << "\n";
  return 0;
}
