use Math.imul for precise 32-bit mul