You have been hired by the Association for Climatological Measurement, a scientific organization interested in track- ing global weather trends over a long period of time. Of course, this is no easy task. They have deployed many small devices around the world, designed to take periodic measurements of the local weather conditions. These are cheap devices with somewhat restricted capabilities. Ev- ery day they observe which of the four standard kinds of weather occurred: Sunny, Cloudy, Rainy, or Frogs. After every n of these observations have been made, the results are reported to the main server for analysis. However, the massive number of devices has caused the available com- munication bandwidth to be overloaded. The Association needs your help to come up with a method of compressing these reports into fewer bits. For a particular device’s location, you may assume that the weather each day is an independent random event, and you are given the predicted probabilities of the four possible weather types. Each of the 4n possible weather reports for a device must be encoded as a unique sequence of bits, such that no sequence is a prefix of any other sequence (an important property, or else the server would not know when each sequence ends). The goal is to use an encoding that minimizes the expected number of transmitted bits. Input The input file contains several test cases, each of them as described below. The first line of input contains an integer 1 ≤ n ≤ 20, the number of observations that go into each report. The second line contains four positive floating-point numbers, psunny, pcloudy, prainy, and pfrogs, representing the respective weather probabilities. These probabilities have at most 6 digits after the decimal point and sum to 1. Output For each test case, display the minimum expected number of bits in the encoding of a report, with an absolute or relative error of at most 10−4. Sample Input 2 0.9 0.049999 0.05 0.000001 20 0.25 0.25 0.25 0.25 Sample Output 1.457510 40.000000