My book says this.
Consider a sequence of independent trials, each of which can be classified as good, bad, or neutral, which happen (on any given trial) with probabilities $p, q,$ and $1 − p − q$, respectively. (We do not necessarily have $q = 1 − p$ here, although that case is allowed.) Then the probability that something good happens before something bad happens is $p/(p + q)$.
My question is, how did they derive this formula $p/(p+q)$ for probability that something good happens before something bad happens?
can someone show me a derivation/explain to me this?