Suppose \(R = [0,2] \cup [5,7]\text{.}\) Then, as in the theorem proof
\begin{equation*}
1 = \int_R c \cdot dx = \int_0^2 c \cdot dx + \int_5^7 c \cdot dx = 4c.
\end{equation*}
Thus, \(f(x) = \frac{1}{4}\text{.}\) For computing probabilities, you will want to break up any resulting integrals in a similar manner.