Dividing numbers equally and dealing with remainders