
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Let $n$ be a given even number, and let $a_1, a_2, \cdots, a_n$ be $n$ non-negative real numbers that sum to 1. Find the maximum possible value of
$$
S=\sum_{1 \leqslant i<j \leqslant n} \min \left\{(j-i)^2, (n-j+i)^2\right\} a_i a_j.
$$

Present the answer in LaTex format: \boxed{Your answer}
user