#include <bits/stdc++.h>
using namespace std;
const int lim = 400100;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const long long mod = 1000000007;
long long a, b;
int main() {
  cin >> a >> b;
  long long ans;
  ans = (b * (b - 1)) / 2;
  ans %= mod;
  ans *= (((b * (((a * (a + 1)) / 2) % mod)) % mod) + a) % mod;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
