Let $ABCD$ be a trapezoid with $AD$ parallel to $BC$, $AD = 2$, and $BC = 1$. Let $M$ be the midpoint of $AD$, and let $P$ be the intersection of $BD$ with $CM$. Extend $AP$ to meet segment $CD$ at point $Q$. If the ratio $\frac{CQ}{QD} = \frac{a}{b}$, where $a$ and $b$ are positive integers and $\text{gcd}(a, b) = 1$, find $a + b$.

Let's think step by step and output the final answer within \boxed{}.
user