#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long a, b;
int32_t main() {
  cin >> a;
  cin >> b;
  cout << ((b * (b - 1) / 2) % 1000000007) *
              (((((a * (a + 1) / 2) % 1000000007) * b + a)) % 1000000007) %
              1000000007;
  return 0;
}
