#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9) + 7;
long long a, b, sum, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> a >> b;
  for (int i = 1; i < b; ++i) sum = (sum + i) % mod;
  for (int i = 1; i <= a; ++i)
    ans = (ans + (((b * i + 1) % mod) * sum) % mod) % mod;
  cout << ans;
  return 0;
}
