how to calculate remainders - Search