Derivation in paper - calculus - How?

Hi all

the paper is Pybus(2000) An integrated framework for the inference of viral population history from reconstructed genealogies

wanted some help with this

In the paper they solve U for gi and get

i dont know how he has done the re arranging. Im not even sure it is correct

can someone please show me how? or if its too much effort tell me what method he used

***********

for those interested U is a uniform unit random variable. Solving for gi will generate a variate sample from an equation.

Thank you guys so much for the help