#000132

Street light bits

You are probably pretty familiar with easy high school tasks, such as:


You have 10 coins, each can fall either head or tails with the same probability. How many bits of information do you receive if you throw each one of them and see the result?


The answer is obviuos, 10 bits. This answer is based on assumption that we don't know anything about the likelihood of coin landing on heads or tails (fair coin).


But on "Pod gozdom" street, the situation is pretty different. There are N street lights and for each you know the probability of it being turned on. For example:


Image: Example

It is your task to determine how many bits of information do we get if we see the state of all N street lights, based on given probability percentages.


InputIn first line, there will be a number 1 <= N <= 2 000 000, representing the number of street lights on the street, followed by N lines. Each line will contain two whole numbers. First number will be either 0 (light is turned off) or 1 (light is turned on), second number wil be the percent (from 0 to 100), telling the probability of light to be turned on.

OutputOutput one real number (rounded to 5 decimals), representing the number of bits.

The test cases won't contain imposible cases (such as: the probabilitiy is 100% and the light is off).


Input:
3
1 30
0 80
1 60


Output:
4.79586

Hint: This task requires basical information theory knowledge. Bit can be defined as "factor of surprise". That means if something you didn't really expect happens, amount of received information is high. In the oposite side, if something highly expected happens, amount of received information is low, as you were almost sure it would happen.

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.