Octopus

An octopus walks a graph starting with no protection, collects tools to raise its shield, and each visit to a predator location risks being eaten with probability max(0, p - h); find the route from s to t with the highest survival probability.

Medium7GraphShortest pathGreedyImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

The octopus is one of the few animals seen using tools on purpose to get a job done. A well known video shows an octopus carrying two coconut half shells across the sea floor and hiding inside them when it feels threatened.

Hiding tools differ in quality. When portable hiding tools are scattered over the sea floor, a small detour to pick up a better one raises the chance of not being eaten. Write a program that plans the route with the highest survival probability.

You are given nn locations on the sea floor and the passages between them. Each location holds a predator, or a hiding tool, or neither. A predator has a detection skill pp, a real number between 00 and 11. A hiding tool has a protective value hh, a real number between 00 and 11. When an octopus using a tool of protective value hh stays at a location with a predator of skill pp, that predator eats it with probability max(0,ph)\max(0, p - h).

The octopus starts at location ss carrying nothing, so its protective value starts at 00. It travels along passages and has to reach location tt. The rules are as follows.

  • Whenever the octopus stays at a location, it faces the predator check of that location. The check also happens at the start location ss and at the target location tt, and it happens again every time the octopus passes the same location again.
  • On reaching a location with a hiding tool, the octopus can pick that tool up. It keeps every tool it picks up, and when it holds several tools it uses the one with the largest protective value.
  • The octopus can travel over the same passage and through the same location any number of times.

The checks are independent of each other. Find the largest probability that the octopus starts at ss and reaches tt alive.

Input

The first line contains the number of data sets KK, with K1K \ge 1. Then come KK data sets in the following form.

The first line of a data set contains four integers nn, mm, ss, tt. Here 1n2001 \le n \le 200 is the number of locations, 0mn20 \le m \le n^2 is the number of passages, and 1s,tn1 \le s, t \le n are the start and target locations.

The next line contains nn real numbers z1,z2,,znz_1, z_2, \ldots, z_n, each between 1-1 and 11. If zi<0z_i < 0, location ii holds a hiding tool of protective value zi-z_i. If zi>0z_i > 0, location ii holds a predator of detection skill ziz_i. If zi=0z_i = 0, location ii holds neither a predator nor a hiding tool.

Each of the next mm lines describes one passage. Line jj contains two integers pjp_j, qjq_j with 1pj<qjn1 \le p_j < q_j \le n, meaning the octopus can travel directly from location pjp_j to qjq_j and from qjq_j to pjp_j. The same passage can appear more than once. There is always a way to get from ss to tt.

Output

For each data set, first print Data Set x: on a line of its own, where xx is the number of the data set counting from 11. On the next line print the largest probability that the octopus reaches location tt alive, rounded to four decimal places. Print exactly four digits after the decimal point.

Print one blank line after each data set.