fast implementation of prodSum.