#include <bits/stdc++.h>
using namespace std;
const long double PI = 2 * acos(0);
const long double eps = 1e-15;
const int inf = 1e9 + 7;
const long long Linf = (long long)1e18 + 7;
const int MOD = 1e9 + 7;
const int LMAX = 1e6 + 7;
const int MAX = 1e5 + 7;
const int BASE = 1e9 + 7;
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};
int a[500005];
int n;
int main() {
  ios::sync_with_stdio(false);
  long long a, b;
  cin >> a >> b;
  cout << (((a * (a + 1) / 2) % MOD * b % MOD + a) % MOD) *
              ((b * (b - 1) / 2) % MOD) % MOD;
}
