#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-11;
const long long MOD = 1000000007;
const int N = 1000000 + 7;
void fast() { std::ios_base::sync_with_stdio(0); }
long long f(long long n) {
  long long x = n;
  long long y = n + 1;
  if (x % 2 == 0)
    x /= 2;
  else
    y /= 2;
  x %= MOD;
  y %= MOD;
  return (x * y) % MOD;
}
int main() {
  long long a, b;
  cin >> a >> b;
  long long Asum = f(a);
  long long Bsum = f(b - 1);
  Asum = (Asum * b) % MOD;
  Asum = (Asum + a) % MOD;
  Asum = (Asum * Bsum) % MOD;
  cout << Asum;
  return 0;
}
