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