
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
Given a positive integer \( n \) and a positive number \( M \), for all arithmetic sequences \( a_1, a_2, a_3, \ldots \) that satisfy \( a_1^2 + a_{n+1}^2 \leq M \), find the maximum value of \( S = a_{n+1} + a_{n+2} + \cdots + a_{2n+1} \).

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