Could anyone show me how to get the second row equation from the first row equation please? For each letter, $p$ is the risk-neutral probability in the risk-neutral world, $u$ is the up factor for the stock, and $d$ is the down factor for the stock, S0 is the beginning stock price. The equation is based on a one-step binomial tree model.
The textbook referred to is Options, futures, and other derivatives by John Hull 10th. Thank you guys.