Multidimensional Expectations
Alice and Bob are playing a simple number game. They both know a function , i. e. the function takes binary arguments and returns a real value. At the start of the game, the variables are all set to . Each round, with equal probability, one of Alice or Bob gets to make a move. A move consists of picking an such that and either setting or .
After rounds all variables are set, and the game value resolves to . Alice wants to maximize the game value, and Bob wants to minimize it.
Your goal is to help Alice and Bob find the expected game value! They will play times though, so between each game, exactly one value of changes. In other words, between rounds and for , for some . You are to find the expected game value in the beginning and after each change.
Input
The first line contains two integers and .
The next line contains integers , denoting the initial values of . More specifically, , if in binary.
Each of the next lines contains two integers and . If in binary, then this means to set .
Output
Print lines, the -th of which denotes the value of the game during the -th round. Your answer must have absolute or relative error within .
Formally, let your answer be , and the jury's answer be . Your answer is considered correct if .
Examples
Consider the second test case. If Alice goes first, she will set , so the final value will be . If Bob goes first, then he will set so the final value will be . Thus the answer is .
In the third test case, the game value will always be regardless of Alice and Bob's play.