Artificial intelligent assistant

Find the expectancy of $X$ > Let $p,q \in (0,1)$. Let $Y$ be the R.V denotes the number of days of the storm in the ocean. $Y\sim \text{Bin}(n,p)$. Let $X$ be the number of ships drowned during the storm and we know that the number of ships drowned in the $k$-day is $\text{Bin}(k,q)$. Find $E(x)$. Now, I look at the solution which starts like this: $$E(X) = E(E(X|Y)) = E(q+2q+\ldots + Yq) = \ldots $$ Why is it true? I thought about splitting $X$ to $\sum_{k=1}^Y X_k$ where $X_k$ is the number of ships drowned in the $k$ day. Hence, $$E(X|Y) = E(\sum_{n=1}^Y X_k| Y) = \sum_{n=1}^Y E(X_k |Y) = \sum_{n=1}^Y E(X_k) = Y\cdot kq$$ But it's not the right answer, apparently.

$E(X|Y=k)$ gives you the expected value of $X$ when you know that the number of days of storm is $k$. Then, since $X\sim Bin(k,q)$ for $k$th day, you have $E(X|Y=k)=\sum_{i=1}^k i q$. Thus $E(X|Y)=\sum_{k=1}^Y kq$. Thus, $$E(X)=E\left(\sum_{k=1}^Y kq\right)=\sum_{j=1}^n \binom{n}{j}p^j (1-p)^{n-j}\sum_{k=1}^j kq=q\sum_{j=1}^n \binom{n}{j}p^j (1-p)^{n-j} \frac{j(j+1)}{2}=\frac{q}{2}\left(E Y^2+E Y\right)=\frac{q}{2}(np(1-p)+2np)=\frac{npq}{2}(3-p)$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2f2608a032c04013713c5a2981a45487