#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30);
const long long mod = (int)1e9 + 7;
const long long INF = (1LL << 60);
int main() {
  long long a, b, temp, ans = 0;
  scanf("%I64d%I64d", &a, &b);
  long long B = ((b * (b - 1)) / 2LL) % mod;
  for (long long i = 1; i <= a; i++) {
    temp = ((i * b + 1LL) % mod * B) % mod;
    ans = (ans + temp) % mod;
  }
  printf("%I64d", ans);
}
