
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 prime number \( p > 3 \), the sequence \( a_1, a_2, \cdots, a_{p-1} \) is a permutation of \( 1, 2, \cdots, p-1 \) such that
\[ p \mid (a_1 a_2 + a_2 a_3 + \cdots + a_{p-2} a_{p-1}). \]

Let the number of such permutations be \( K \). Find the remainder of \( K \) modulo \( p(p-1) \).

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