spoj#KHANS. Alia and 3 Khans
Alia and 3 Khans
3 KHANS of Bollywood are planning to work together in a film called "Three_Khans". Aamir (being perfect :P) wants the Alia to be a main lead. But Alia (being very famous :P) is confused that whether to work in a film or not. So they all have decided to play a game called "Filmy_Sequence".
According to this game, Aamir will give any number to Alia to play with it. Alia has to find two other numbers using it. That two numbers represent Stardom of Salman and Srk. These two numbers shoud be found in such a way so that both numbers will have same number of set ('1') bits in their binary representation as Aamir's number contains. One thing is also need to be checked that Salman's number should be just next greater number to Aamir's number and Srk's number should be just next smaller number to Aamir's number (i.e in a order of their Stardom :P). They all have decided that if this "Filmy_Sequence" forms a G.P (Geometric Progression) then Alia has to be in the favour of movie else not. Alia needs your help to find the probabilty that she will work in a film and she also wants to find the mean of the Stardum of Salman over Srk.
Note : All the three numbers should be positive and in a range upto 32 bits, and if not possible assume -1. (i.e if particular number is not possible with respect to Aamir's number, assume it as -1)
Input Format :
first line will have a number of numbers that Aamir will give (t) next t lines will have Aamir's number (n)
Output Format :
print the asked probability and mean. Any results within 10^-6 absolute error will be accepted.
Constraints :
t <= 1000000
0 <= n <= 1000000
Sample Input 1:
3
1
2
3
Sample Output 1:
0.333333 4.000000
Sample Input 2 :
2
5
6
Sample Output 2 :
0.000000 3.500000
Explanation :
Case 2 : 5 -> 3,5,6 and 6-> 5,6,9 are the required numbers.