#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long a, b;
long long ans = 0;
long long a1, b1;
void init() { cin >> a >> b; }
void work() {
  a1 = (a % 2 == 0) ? ((a / 2) * (a + 1)) : (a * ((a + 1) / 2));
  a1 %= M;
  b1 = (b % 2 == 0) ? ((b / 2) * (b - 1)) : (b * ((b - 1) / 2));
  b1 %= M;
  ans = (((a1 * b1) % M) * b) % M;
  ans = (ans + a * b1) % M;
  cout << ans << endl;
}
int main() {
  init();
  work();
  return 0;
}
