#include <bits/stdc++.h>
using namespace std;
void fun(long long a, long long b) {
  long long int q = b + 1, total = 0, mod = 1e9 + 7;
  int i;
  for (i = 0; i < a; i++) {
    total = (total + q + mod) % mod;
    q = (q + b + mod) % mod;
  }
  long long t = total, ans = 0;
  for (i = 1; i < b; i++) {
    ans = (ans + total + mod) % mod;
    total = (total + t + mod) % mod;
  }
  cout << ans << endl;
}
int main() {
  long long a, b;
  cin >> a >> b;
  fun(a, b);
  return 0;
}
