#include <bits/stdc++.h>
using namespace std;
long long a, b, ans;
long long binpow(long long x, long long y) {
  long long z = 1;
  while (y) {
    if (y & 1) z = (z * x) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return z;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b;
  ans = 1;
  ans = (ans * a) % 1000000007;
  ans = (ans * b) % 1000000007;
  ans = (ans * (b - 1)) % 1000000007;
  ans = (ans * (((2) % 1000000007 + (b) % 1000000007 + (a * b) % 1000000007) %
                1000000007)) %
        1000000007;
  ans = (ans * binpow(4, 1000000007 - 2)) % 1000000007;
  cout << ans;
  return 0;
}
