Under construction

Still being built. Things may change

Joy

Time limit2sMemory limit512 MB

Summary
Given a queue of n-1 players and your skill x, find for each of the n insertion positions the probability that you win the knockout tournament.
Level

Hard8 of 10

Topics
Divide and conquer, Dynamic programming, Probability
Solved
No attempts yet

Problem

Suppose n−1n-1 other people with skill levels a1,a2,…,an−1a_1, a_2, \ldots, a_{n-1} are standing in a queue for a rock paper scissors tournament, and your skill level is xx. You insert yourself into one of the nn positions in the queue: before person 1, between person 1 and person 2, and so on, up to after person n−1n-1. For each position, find the probability that you win the tournament.

The tournament runs as follows. While the queue has at least two people, pop the two people at the front and have them play a match. If players with skill levels pp and qq play, the first one wins with probability pp+q\frac{p}{p+q} and the second one wins with probability qp+q\frac{q}{p+q}. There are no draws.

The winner goes to the back of the queue, and the loser is eliminated. The last person standing is the winner of the tournament.

Input

The first line contains two integers nn and xx (2≤n≤40962 \le n \le 4096, n=2kn = 2k for an integer kk, 1≤x≤1041 \le x \le 10^4).

The second line contains n−1n-1 integers a1,a2,…,an−1a_1, a_2, \ldots, a_{n-1} (1≤ai≤1041 \le a_i \le 10^4). a1a_1 is the skill level of the person at the front of the queue, and an−1a_{n-1} is the skill level of the person at the back.

Output

For each of the nn positions in the queue, from front to back, print the probability that you win the tournament, one per line. Answers with an absolute or relative error of at most 10−910^{-9} are accepted.

Hint

In the first test case, you beat any opponent with probability 23\frac{2}{3}. To win the tournament, you must beat two opponents, so the answer is 49\frac{4}{9} regardless of your starting position.

Examples3

  1. Example 1

    Input
    4 2
    1 1 1
    
    Expected output
    0.444444444444444
    0.444444444444444
    0.444444444444444
    0.444444444444444
    
  2. Example 2

    Input
    4 3
    4 5 2
    
    Expected output
    0.188265306122449
    0.188265306122449
    0.239285714285714
    0.239285714285714
    
  3. Example 3

    Input
    8 8
    1 2 3 4 5 6 7
    
    Expected output
    0.393768719371413
    0.393768719371413
    0.353382184051268
    0.353382184051268
    0.248207450668989
    0.248207450668989
    0.230924146560510
    0.230924146560510