In POWPOW2 problem, how did we calculate b^2ncn % 1000000007 =?

why are we calculating " b^2ncn mod 500000003 " ? how did we get here from previous condition ? i’m not clear how we used totient to change the value of mod ?