#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;
long long N, M, mod = 1e9 + 7;
long long seg(long long x) {
  long long a = x, b = x + 1;
  if (a % 2)
    b /= 2;
  else
    a /= 2;
  a %= mod;
  b %= mod;
  return (a * b) % mod;
}
int main() {
  long long ans, a, b, sa, sb;
  cin >> a >> b;
  sa = seg(a);
  sb = seg(b - 1);
  ans = (b * sa) % mod;
  ans = (ans + a) % mod;
  ans = (ans * sb) % mod;
  cout << ans << "\n";
  return 0;
}
