
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 the function $f(x) = \sin(\omega x + \varphi)$ ($\omega > 0$, $0 < \varphi < \pi$) has a minimum positive period of $\pi$, and one of its symmetry centers is $(\frac{\pi}{4}, 0)$. If we stretch all the x-coordinates of the points on the graph of function $f(x)$ by a factor of 2 (keeping the y-coordinates unchanged), and then shift the resulting graph to the right by $\frac{\pi}{2}$ units, we obtain the graph of function $g(x)$.  
(1) Find the expressions for functions $f(x)$ and $g(x)$.  
(2) Find the real number $a$ and the positive integer $n$, such that $F(x) = f(x) + ag(x)$ has exactly 2017 zeros in the interval $(0, n\pi)$.

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