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