#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long x, y, m = 1e9 + 7;
  cin >> x >> y;
  long long a = ((((x * (x + 1) / 2) % m) * y) % m + x) % m;
  long long b = (y * (y - 1) / 2) % m;
  cout << (a * b) % m;
}
