#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b;
  cin >> a >> b;
  long long r1 = (b * (b - 1) / 2) % mod;
  long long r3 = (a * (a + 1) / 2) % mod;
  long long r2 = (r3 * b + a) % mod;
  long long answer = (r2 * r1) % mod;
  cout << answer << endl;
  return 0;
}
