#include <bits/stdc++.h>
using namespace std;
template <typename A>
ostream &operator<<(ostream &cout, vector<A> const &v) {
  cout << "[";
  for (int i = 0; i < int((v).size()); i++) {
    if (i) cout << ", ";
    cout << v[i];
  }
  return cout << "]";
}
template <typename A, typename B>
ostream &operator<<(ostream &cout, pair<A, B> const &p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A, typename B>
istream &operator>>(istream &cin, pair<A, B> &p) {
  cin >> p.first;
  return cin >> p.second;
}
namespace number_theory {
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  if (y == 0) return x;
  return gcd(y, x % y);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i += 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool prime[15000105];
void sieve(int n) {
  for (long long i = 0; i <= n; i++) prime[i] = 1;
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  prime[1] = prime[0] = 0;
}
vector<long long> primelist;
bool __primes_generated__ = 0;
void genprimes(int n) {
  __primes_generated__ = 1;
  sieve(n + 1);
  for (long long i = 2; i <= n; i++)
    if (prime[i]) primelist.push_back(i);
}
vector<long long> factors(long long n) {
  if (!__primes_generated__) {
    exit(1);
  }
  vector<long long> facs;
  for (long long i = 0;
       primelist[i] * primelist[i] <= n && i < primelist.size(); i++) {
    if (n % primelist[i] == 0) {
      while (n % primelist[i] == 0) {
        n /= primelist[i];
        facs.push_back(primelist[i]);
      }
    }
  }
  if (n > 1) {
    facs.push_back(n);
  }
  sort(facs.begin(), facs.end());
  return facs;
}
}  // namespace number_theory
using namespace number_theory;
void kkvanonymous() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
void solve() {
  long long a, b;
  cin >> a >> b;
  long long t = (b * (b - 1)) / 2;
  t %= 1000000007;
  long long sum = 0;
  for (long long i = 1; i < a + 1; i++) {
    long long temp = (b * i + 1) % 1000000007;
    sum += ((temp * t) % 1000000007) % 1000000007;
    sum %= 1000000007;
  }
  cout << sum;
}
int main() {
  kkvanonymous();
  int t = 1;
  while (t--) solve();
  return 0;
}
