Diver

Time limit3sMemory limit128 MB

Problem

A diver has just finished her mission in the depths of the ocean and needs to return to the surface. She can only move up or down along a rope that hangs straight down from her boat at the surface to her position $d$ feet under water.

While she was working, several sharks gathered near the rope. They do not yet consider her a threat or prey, but if she ever comes closer than $r$ feet to any shark, that shark immediately attacks her.

To avoid decompression sickness, the diver can descend or ascend at a speed of at most $v_d$ feet per second. She also cannot go deeper than $d$ feet under water.

Each shark $i$ swims at its own constant depth of $d_i$ feet near the rope. The speed and pattern of movement are the same for all sharks. A shark cannot stay still in the water, so to avoid sinking it constantly swims back and forth at a constant speed $v_s$: it moves away from the rope up to a distance of $w$ feet and then swims back to the rope again. A shark changes direction so quickly that we treat it as instantaneous. An attack also happens so quickly that we treat it as instantaneous the moment the diver enters a circle of radius $r$ feet around a shark.

The diver is always on the rope (her horizontal distance from the rope is $0$), so the distance between the diver and a shark is the hypotenuse of the right triangle whose legs are the difference in their depths and the shark's horizontal distance from the rope, i.e. $\sqrt{(\text{depth difference})^2 + (\text{shark's horizontal distance})^2}$.

Determine whether the diver can reach the surface without being attacked by a shark, and if so, how fast she can do it.

Input

The first line contains $6$ integers:

  • $d$ ($10 \le d \le 100$) — the initial depth of the diver.
  • $v_d$ ($1 \le v_d \le 10$) — the maximal speed of the diver.
  • $n$ ($1 \le n \le 20$) — the number of sharks.
  • $r$ ($1 \le r \le 10$) — the minimal safe distance between a shark and the diver.
  • $w$ ($10 \le w \le 100$) — the maximal distance that a shark swims away from the rope.
  • $v_s$ ($1 \le v_s \le 50$) — the speed of a shark.

Then follow $n$ lines describing the sharks, with $3$ integers per line:

  • $d_i$ ($1 \le d_i < d$) — the depth of the $i$-th shark.
  • $w_i$ ($0 \le w_i \le w$) — the initial distance from the $i$-th shark to the rope.
  • $f_i$ ($f_i$ is $1$ or $-1$) — the initial direction of the $i$-th shark's movement: $1$ if it swims away from the rope, or $-1$ if it swims toward the rope.

Initially the diver is more than $r$ feet from any shark.

Output

If the diver cannot reach the surface, print IMPOSSIBLE.

Otherwise, print the minimal time needed to reach the surface, rounded to one decimal place (using round half up).