Let $a$ in $[0, \pi]$ such that $\frac13\sin a-\frac17\cos a=\frac{1}{2017}.$ If $\lvert\tan{a}\rvert=\frac mn$, where m and n are relatively prime, find m+n.
My work:
$\frac13\sin a-\frac17\cos a=\frac{1}{2017}$
From the trig identity $a \cos{t} + b \sin{t} = \sqrt{a^2 + b^2} \; \sin(t + \tan^{-1} \frac{a}{b})$ it follows that:
$\sqrt{\frac{1}{9}+\frac{1}{49}}\sin (a-\arctan{\frac37})=\frac{1}{2017}$
$a=\arcsin{\frac{1}{2017\sqrt{\frac{58}{441}}}}+\arctan{\frac37}$
...
From here I bashed out long equations using more trig identities/cancelling by taking the sine of both sides, but I did not get a fraction and the work is not worth putting here. I'm assuming the approach of using $a \cos{t} + b \sin{t} = \sqrt{a^2 + b^2} \; \sin(t + \tan^{-1} \frac{a}{b})$ was somehow incorrect or I made a simple error somewhere later on.
When I originally tried solving this problem I multiplied through by 3*7*2017 but this leads to the same issue and gigantic numbers everywhere.
Is there a better approach to solving this?
This question was from the AMSP 2017 Test C entrance exam.