Let $P(x) = x^3 + ax^2 + bx + 5.$  The remainder $R(x)$ has degree at most 1, so let $R(x) = cx + d.$

When $P(x)$ is divided by $(x - 1)(x - 4),$ the quotient is of the form $x + p,$ so write
\[P(x) = (x + p)(x - 1)(x - 4) + R(x) = (x + p)(x - 1)(x - 4) + cx + d.\]Comparing the coefficients of $x^2,$ we get $a = p - 5.$

When $P(x)$ is divided by $(x - 2)(x - 3),$ the quotient is of the form $x + q,$ so write
\[P(x) = (x + q)(x - 2)(x - 3) + 2R(x) = (x + q)(x - 2)(x - 3) + 2(cx + d).\]Comparing the coefficients of $x^2,$ we get $a = q - 5.$  Hence, $p = q.$

Comparing the coefficients of $x$ in both equations, we get
\begin{align*}
b &= c - 5p + 4, \\
b &= 2c - 5p + 6.
\end{align*}Subtracting these equations, we get $c + 2 = 0,$ so $c = -2.$

Comparing the constant coefficients in the first equation, we get $5 = 4p + d.$  Therefore,
\[P(5) = (5 + p)(4)(1) - 10 + d = 10 + 4p + d = \boxed{15}.\]
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Let $P(x)$ be a monic polynomial of degree 3.  Suppose that $P(x)$ has remainder $R(x)$ when it is divided by $(x - 1)(x - 4),$ and remainder $2R(x)$ when it is divided by $(x - 2)(x - 3).$  Given that $P(0) = 5,$ find $P(5).$
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
15
Let $P(x)$ be a monic polynomial of degree 3.  Suppose that $P(x)$ has remainder $R(x)$ when it is divided by $(x - 1)(x - 4),$ and remainder $2R(x)$ when it is divided by $(x - 2)(x - 3).$  Given that $P(0) = 5,$ find $P(5).$
test