Under construction

Still being built. Things may change

Caves

Time limit2sMemory limit256 MB

Summary
Given cave tunnels and treasure probabilities, find the minimum expected time to reach the treasure by walking the probe or paying t to insert a new one.
Level

Medium7 of 10

Topics
Dynamic programming, Bit manipulation, Shortest path, Graph
Solved
No attempts yet

Problem

Sophie is a treasure seeker. She is looking for a treasure hidden in a system of nn caves, numbered from 11 to nn. The cave system contains exactly one treasure, in one of the caves. Sophie used a georadar, which did not reveal where the treasure is, but gave her a probability for each cave that the treasure is in that cave.

Sophie continues the search with a precise remote probe. When the probe enters a cave, it immediately finds out whether that cave contains the treasure. The probe starts in cave 11, and it is known that this cave does not contain the treasure. Sophie knows which pairs of caves are connected by bidirectional tunnels that the probe can traverse. Each traversal takes the probe one minute. The probe may not be able to reach every cave, even in many steps.

Instead of traversing a tunnel, Sophie can abandon the probe and insert a new one, which takes tt minutes. The old probe is then lost, and Sophie can no longer use it. A new probe is imprecise: it lands in each of the nn caves with probability 1n\frac{1}{n}. Sophie immediately learns where the probe has landed. Sophie has infinitely many probes.

Help Sophie find the treasure quickly. Given the size of the cave system, the tunnels, the insertion time tt, and the probability distribution of the treasure, compute the smallest expected time over all of Sophie's strategies. Finding the treasure means reaching the treasure cave with a probe.

Input

The first line contains three space-separated integers nn, mm, tt (2≤n≤202 \le n \le 20, 0≤m≤n(n+1)20 \le m \le \frac{n(n+1)}{2}, 1≤t≤1001 \le t \le 100). They denote the number of caves, the number of tunnels, and the time needed to insert a new probe.

The second line contains nn space-separated real numbers p1,p2,…,pnp_1, p_2, \ldots, p_n (p1=0p_1 = 0, 0≤pi≤10 \le p_i \le 1, ∑i=1npi=1\sum_{i=1}^{n} p_i = 1). The number pip_i is the probability that the treasure is in cave ii. These values have two decimal digits of precision.

Each of the next mm lines contains two space-separated integers ii, jj (1≤i,j≤n1 \le i, j \le n, i≠ji \ne j), describing a tunnel between caves ii and jj that the probe can traverse in either direction. All tunnels are distinct.

Output

Print one real number, the minimum possible expected time of finding the treasure. The answer is accepted if its absolute or relative error is at most 10−610^{-6}.

Hint

In sample 1, Sophie first moves the probe to cave 22, then to cave 33. With probability 12\frac{1}{2}, she finds the treasure at time 22. Otherwise, she inserts new probes until one lands in cave 44. The expected number of insertions is 44, so the expected total time in this case is 4242. On average, Sophie finds the treasure in 2222 seconds. After 22 minutes, Sophie already knows where the treasure is, but she still needs a probe to reach it.

Examples2

  1. Example 1

    Input
    4 2 10
    0.00 0.00 0.50 0.50
    1 2
    2 3
    
    Expected output
    22.000000000
    
  2. Example 2

    Input
    6 5 2
    0.00 0.00 0.00 0.00 0.50 0.50
    1 2
    2 3
    3 4
    4 5
    5 6
    
    Expected output
    4.100000000