There are students standing in line in positions
to
. While the teacher looks away, some students change their positions. When the teacher looks back, they are standing in line again. If a student who was initially in position
is now in position
, we say the student moved for
steps. Determine the maximal sum of steps of all students that they can achieve.