This is somewhat similar to one I posted here years ago, but, I suspect, is much harder. Be warned.
A hat (upside down, of course) contains a black jelly beans and b orange jelly beans. You reach in and randomly remove a jelly bean. If it is black, you return it to the hat with a probability of p, otherwise you eat it. If it is orange, you return it to the hat with a probability of q, otherwise you eat it. What is the probability that the last jelly bean in the hat will be black?/orange?
Note that p and q are independent of each other, and cannot be one.