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