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