mul (a, b) { auto r 0; if (a < 0) a = -a, b = -b; while (a) { if (a & 1) r += b; a >>= 1; b <<= 1; } return r; }