#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b, long long int c) {
  long long int y = a, x = 1;
  while (b > 0) {
    if (b % 2 == 1) x = (x * y) % c;
    y = (y * y) % c;
    b = b / 2;
  }
  return x % c;
}
long long int f(long long int a) {
  return ((a % 1000000007) * (a + 1) % 1000000007 *
          power(2, 1000000007 - 2, 1000000007)) %
         1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  long long int a, b, m, n;
  long long int ans = 0;
  cin >> a >> b;
  m = (f(a) % 1000000007 * f(b - 1) % 1000000007) % 1000000007;
  n = (a % 1000000007 * (f(b - 1)) % 1000000007) % 1000000007;
  ans = ((m % 1000000007 * b) % 1000000007 + n) % 1000000007;
  cout << ans << endl;
  return 0;
}
