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$.


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$
