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