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