Overflow problem using ary.product

Yes, that did it for that.
Now have to fix other overflows from using that result.
(This is a translation of Ruby code).