Let $S=\left\{ \frac{p}{q} \mid q \leq 2009, \frac{p}{q} < \frac{1257}{2009}, p,q \in \mathbb{N} \right\}$. If the maximum element of $S$ is $\frac{p_0}{q_0}$ in reduced form, find $p_0+q_0$.

Let's think step by step and output the final answer within \boxed{}.
user