Let $X$ and $Y$ be independent random variables, with known moment generating functions $M_X(t)$ and $M_Y (t)$ and $I$ be such that $P(I = 1) = 1 − P(I = 0) = p \in (0, 1)$. Compute the moment generating function of the random variable $S = IX + (1−I)Y $.
I am given the hint that taking condition on I may help but still I have no idea how to compute. Any help would be appreciated.