Dividing the numbers

CodeForces - 899C