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