const
  MODUO = 1000000007;

var
  m, n, sol, tmp : int64;
  i : longint;

begin

  readln(n, m);

  if (m < n) then begin
      tmp := m; m := n; n := tmp;
  end;

  sol := 0;

  for i := 1 to n do begin
      tmp := ((n - i + 1) * (m - i + 1)) mod MODUO;
      sol := (sol + i * tmp) mod MODUO;
  end;

  writeln(sol);

end.