If $f(a)$ is divisible by either $101$ or $107$ for each $a\in\Bbb{Z}$, then $f(a)$ is divisible by at least one of them for all $a$ I've been struggling with this problem for a while, I really don't know where to start:

Let $f(x) \in \mathbb{Z}[X]$ be a polynomial such that for every value of $a \in \mathbb{Z}$, $f(a)$ is always a multiple of $101$ or $107$. Prove that $f(a)$ is always divisible by $101$ for all values of $a$, or that $f(a)$ is divisible by 107 for all values of $a$.

 A: If neither of the statements "$f(x)$ is always divisible by $101$" or "$f(x)$ is always divisible by $107$" is true, then there exist $a,b\in{\bf Z}$ so that $107\nmid f(a)$ and $101\nmid f(b)$. It follows from hypotheses that
$$\begin{cases} f(a)\equiv 0\bmod 101 \\ f(a)\not\equiv0\bmod 107\end{cases}\qquad \begin{cases}f(b)\not\equiv 0\bmod 101 \\ f(b)\equiv 0\bmod 107\end{cases}$$
Let $c\in{\bf Z}$ be $\equiv a\bmod 107$ and $\equiv b\bmod 101$. Is $f(c)$ divisible by $101$ or $107$?
A: Hint: Divisiblility of $f(x)$ by $101$ depends only on the residue class of $x \mod 101$.
A: Let's abstract away the details by replacing $101, 107$ with any two ideals $\mathfrak{a}$, $\mathfrak{b}$ of some ring $R$  such that $\mathfrak{a}+\mathfrak{b}=R$. The condition is: $f(R)\subset \mathfrak{a} \cup \mathfrak{b}$, and we would like to show that either $f(R)\subset \mathfrak{a}$ or $f(R)\subset \mathfrak{b}$.
Suppose for contradiction that this wasn't the case. Then pick $a,b\in R$ such that $f(a)\not\subset\mathfrak{a}$ and $f(b)\not\subset\mathfrak{b}$. But now choose any $y\in (a+\mathfrak{a})\cap(b+\mathfrak{b})$ (the intersection is non-empty by the hypothesis on $\mathfrak{a}, \mathfrak{b}$) to obtain $f(y)\not\subset \mathfrak{a}\cup\mathfrak{b}$, contradiction. $\square$
