how to calculate the remainder - Search