Calculate the ways of teacher movement