#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
inline int mul(int a, int b) { return (long long)a * b % MOD; }
inline int add(int a, int b) { return (a + b) % MOD; }
int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int sum = b % 2 ? mul(b, (b - 1) / 2) : mul(b / 2, b - 1);
  for (int k = 1; k <= a; ++k) {
    ans = add(ans, mul(sum, add(mul(k, b), 1)));
  }
  cout << ans << endl;
  return 0;
}
