a clever optimization using imul