Problem #165
L's Successor
L is fighting Kira which can be dangerous as Kira has the Death Note. Watari has to decide a successor for L in case L dies. Watari gives a point (x,y,z) in cartesian plane to Mello and Near and they have to play a game such that they take turns. In one turn, the player can change one of the coordinates (say w) to [w/2], [w/3], [w/5].(w > 0) So (8,9,10) can be reduced to (4,9,10) or (2,9,10) or (1,9,10) or (8,9,3) and so on. The person who changes the point to origin wins the game. Watari wants Near to win but he forgot the z coordinate so he randomly selects z between 0 and 12345 ( both inclusive ). So the point is L(2^{60}, 2^{61}, z), where z is between 0 and 12345 (both inclusive). Given that Near starts play calculate the probability that Near will win the game if both players play optimally.
If the answer is of the form u/v where u and v are co prime you have to input u+v as the answer.