#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int r = 1; r < b; ++r) {
    long long n = a;
    long long tmp = (n * (n + 1) / 2) % 1000000007;
    tmp = (tmp * b) % 1000000007;
    tmp = (tmp * r) % 1000000007;
    tmp = tmp + (n * r) % 1000000007;
    ans = (tmp + ans) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
