# Permutation Distances

$$x_i$$ is a permutation of $$\{ 1, 2, \ldots, 402 \}$$. What is the largest value of $$S = | \ldots | | |x_1 - x_2| -x_3| - x_4 | - \ldots -x_{402} |$$?

Details and assumptions

$$| \cdot |$$ is the absolute value function, which satisfies

$$|x| = \begin{cases} x & x \geq 0 \\ -x & x < 0 \end{cases} \\$$

For example, $$| 5 | = 5, |-7| = 7$$.

×