Colored egg carriage problem Bob has lots of painted eggs to $50$ different colors. He wants to carry one egg of each color from point $A$ to $B$. The probability that he breaks an egg is $P$ (same for all colors). I want to formulate cost of carrying all $50$ eggs for two different conditions:


If there is any broken egg when he reaches point $B$, he goes back to point $A$ and tries to bring eggs of the same color he broke (only broken eggs will be brought and he can take one egg of each color).
If there is any broken egg when he reaches point $B$, he goes back to point $A$ and tries to bring all eggs from scratch (all $50$ eggs will be brought again).


Going from point $A$ to $B$ count as $1$ cost. Going back to from $B$ to $A$ does not count.
[Edit: The question has been clarified. I'll leave my original interpretation and answer because it is beneficial as stepping stone to the new question.]

Let $n$ be the number of eggs and $p$ be the probability that each egg breaks, independently of other eggs.

[My original interpretation of the second condition: All eggs are discarded at B if at least one is broken, and he goes back to A and restarts the whole procedure.]

Let $x$ be the expected number of trips and find an equation for $x$ by considering the expected number of trips after one trip. There are two cases corresponding to whether no eggs break or at least one egg breaks. I'm sure you can compute the probability $q$ that the first case occurs, in terms of $n$ and $p$. In that case we need to restart the whole procedure and so the expected number of trips from that point is $x$. In the other case we are done and the expected number of trips from that point is $0$. So we get $x = 1 + q \cdot x + (1-q) \cdot 0$ and then we can find $x$.

[The new question: Unbroken eggs are kept at B and he stops if he has at least 1 unbroken egg of each colour at B.]

Note that the two conditions are equivalent because bringing a egg of a colour that he already has (unbroken) at B makes no difference. Let $f(k)$ be the expected number of trips where $k$ eggs need to be brought. Clearly $f(0)=0$. For each $k&gt;0$, there are now $k+1$ cases corresponding to how many eggs break on the first trip, and you can compute the probability that each case occurs, which gives as before a linear equation involving $f(k)$ and $\{ f(m) : 0 \le m \le k \}$ with coefficients depending on $p$ and $n$, which is $f(k) = 1 + \sum_{m=0}^k P(m\text{ eggs broke}) f(m)$. You can now see that you can find $f(k)$ for any $k$ from $1$ to $n$.
Let's divide this by steps. Let step 1 be the travel between point $A$ and point $B$.

You have $P(x)$ as a chance to break one single egg on arrival to $B$. As the probability is equal for all other eggs, and assuming the events are independent, the probability of $n$ eggs breaking is given by $P(x)^n$.

This being said, one can calculate the chance all eggs arrive safely to the other side.

$$
P = 1 - \sum_{i=1}^{n} P(x)^n
$$

The cost for the 1st step is therefore given by the following:

$$
Cost = P \times C
$$

Where $C$ is the cost of the travel. However, this doesn't account the fact that you have to get back and get any egg that broke. To get the total cost one would have to consider all hypothesis iteratively. Assuming that no egg broke on the way back, we would have a repetition of the thought process in the first step. The cost for the 2nd step would be the following.

$$
Cost = P \times C + (1-P)(P \times 2C)
$$

Note the $2C$, as you had to travel two times.

For the 3rd step:

$$
Cost = P \times C + (1-P)(P \times 2C) + (1-P)(1-P)(P \times 3C)
$$

The full series (and as such, the full cost) is the following:

$$
Cost = \sum_{i=1}^{n \rightarrow \infty} iPC (1-P)^{i-1}
$$

The answer is valid for both situations, as replacing one or every egg has no cost or effect on probability, the only thing that matters are the rides from $A$ to $B$.