Map Generator

No attempts yetTime limit1sMemory limit128 MB

Problem

In a space-themed game, mankind is scattered across NN mutually hostile planets. Travel between planets uses special hyperspace tunnels. Each tunnel connects two planets and works for two-way communication. At most one tunnel may connect any pair of planets. The set of all tunnels is called the map of the game.

The map is generated at random by the following procedure. For each pair of distinct planets ii and jj (1i<jN1 \le i < j \le N), a real number XijX_{ij} (0Xij10 \le X_{ij} \le 1) is generated independently from the uniform distribution. If XijPX_{ij} \le P, where PP is a given real parameter, the tunnel connecting planets ii and jj is added to the map. (Consequently each pair is connected independently with probability PP.)

A map is connected if, between every pair of planets, there is a path made of one or more tunnels. Given NN and PP, compute the probability that this procedure generates a connected map.

Input

The first line contains an integer NN (1N201 \le N \le 20).

The second line contains a real number PP (0P10 \le P \le 1).

Output

Print, on a single line, the probability that the generated map is connected, rounded to exactly 6 digits after the decimal point (for example, 0.500000).