
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 the sum of the first $n$ terms of the sequence $\{a_n\}$ be $S_n$, and $S_n=n^2-n+1$. In the positive geometric sequence $\{b_n\}$, $b_2=a_2$ and $b_4=a_5$.

$(1)$ Find the general formula for $\{a_n\}$ and $\{b_n\}$.

$(2)$ Let $c_n=a_nb_n$, find the sum of the first $n$ terms of the sequence $\{c_n\}$.

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