Arithmetic overflow in rem and mod