#include <bits/stdc++.h>
int main() {
  int a, b, ans, r;
  fscanf(stdin, "%d%d", &a, &b);
  ans = 0;
  for (r = 1; r < b; r++) {
    ans = (ans +
           (r * (long long)(a + (b * (long long)((a * (long long)(a + 1) / 2) %
                                                 1000000007)) %
                                    1000000007)) %
               1000000007) %
          1000000007;
  }
  fprintf(stdout, "%d\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
