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