Calculate the ways the teacher move