/*--------------------------------------------------------------*/
/* ACM ICPC 2007-2008                                           */
/* Northeastern European Regional Contest                       */
/* St Petersburg - Barnaul - Tashkent - Batumi, November 28, 200*/
/*--------------------------------------------------------------*/
/* Problem D. Diver                                             */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Roman Elizarov                         */
/*--------------------------------------------------------------*/
 
/*
    Solution for NEERC'2007 Problem D: Diver
    (C) Roman Elizarov
    Note: this solution attempts to check correctness of the input
*/

import java.io.*;
import java.util.*;

public class diver_re {
	private static final double EPS = 1e-7;

	public static void main(String[] args) throws Exception {
		new diver_re().go();
	}

	private static int cmp(double a, double b) {
		return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;
	}

	private static boolean between(double a, double b, double c) {
		if (cmp(b, c) > 0) {
			double t = b;
			b = c;
			c = t;
		}
		return cmp(a, b) >= 0 && cmp(a, c) <= 0;
	}

	private static int hash(double a) {
		return (int)(a / (3 * EPS));
	}

	public class Pt implements Comparable<Pt> {
		double x;
		double y;

		public Pt(double x, double y) {
			this.x = x;
			this.y = y;
		}

		public int compareTo(Pt p) {
			int i = cmp(x, p.x);
			if (i != 0)
				return i;
			return cmp(y, p.y);
		}

		public boolean equals(Object o) {
			return compareTo((Pt)o) == 0;
		}

		public int hashCode() {
			return hash(x) ^ hash(y);
		}

		public String toString() {
			return "[" + x + ", " + y + "]";
		}
	}

	public class Circle extends Pt {
		final Set<Pt> kp = new HashSet<Pt>();

		public Circle(double x, double y) {
			super(x, y);
		}
	}

	public class Graph {
		final Map<Pt, Set<Pt>> pts = new HashMap<Pt, Set<Pt>>();

		private void add(Pt a, Pt b) {
			node(a).add(b);
			node(b); // make sure it exists
		}

		private Set<Pt> node(Pt a) {
			Set<Pt> sa = pts.get(a);
			if (sa == null)
				pts.put(a, sa = new HashSet<Pt>());
			return sa;
		}
	}

	int d;
	int vd;
	int n;
	int r;
	int w;
	int vs;

	int[] di;
	int[] wi;
	int[] fi;

	double v;
	double sx;
	double sy;

	final List<Circle> circles = new ArrayList<Circle>();
	final Graph g = new Graph();
	final Set<Pt> s = new HashSet<Pt>();
	final LinkedList<Pt> q = new LinkedList<Pt>();

	void go() throws Exception {
		// read input
		XScanner in = new XScanner(new File("diver.in"));
		in.useLocale(Locale.US);
		d = in.nextInt();
		vd = in.nextInt();
		n = in.nextInt();
		r = in.nextInt();
		w = in.nextInt();
		vs = in.nextInt();
		in.nextLine();

		assert d >= 10 && d <= 100;
		assert vd >= 1 && vd <= 10;
		assert n >= 1 && n <= 20;
		assert r >= 1 && r <= 10;
		assert w >= 10 && w <= 100;
		assert vs >= 1 && vs <= 50;

		di = new int[n];
		wi = new int[n];
		fi = new int[n];

		for (int i = 0; i < n; i++) {
			di[i] = in.nextInt();
			wi[i] = in.nextInt();
			fi[i] = in.nextInt();
			in.nextLine();

			assert di[i] >= 1 && di[i] < d;
			assert wi[i] >= 0 && wi[i] <= w;
			assert fi[i] == -1 || fi[i] == 1;
		}
		in.close();

		// solve

		// create virtual cicles
		for (int i = 0; i < n; i++) {
			double x = mod(fi[i] == -1 ? wi[i] : 2 * w - wi[i], 2 * w);
			int y = di[i];
			circles.add(new Circle(x, y));
			if (x < r)
				circles.add(new Circle(x + 2 * w, y));
			if (x > 2 * w - r)
				circles.add(new Circle(x - 2 * w, y));
		}

		// check initial constraint
		assert okPoint(0, d);

		v = (double)vd / vs;
		sx = r * v / Math.sqrt(1 + sqr(v));
		sy = Math.sqrt(sqr(r) - sqr(sx));

		// determine key points for each circle
		for (Circle u : circles) {
			// Phase 1 : find drop-off point
			double x = u.x + sx;
			double y = u.y + sy;
			// trim it to the right
			if (cmp(x, 2 * w) > 0) {
				x = 2 * w;
				y = u.y + Math.sqrt(sqr(r) - sqr(2 * w - u.x));
			}
			// trim it to circles
			for (Pt v : circles)
				if (!okWrt(x, y, v)) {
					double vx = v.x - u.x;
					double vy = v.y - u.y;
					double len = Math.sqrt(sqr(vx) + sqr(vy));
					vx /= len;
					vy /= len;
					len /= 2;
					double ofs = Math.sqrt(sqr(r) - sqr(len));
					double x1 = u.x + vx * len - vy * ofs;
					double y1 = u.y + vy * len + vx * ofs;
					if (between(x1, u.x - sx, x)) {
						x = x1;
						y = y1;
					}
				}
			if (okPoint(x, y))
				u.kp.add(new Pt(x, y));

			// Phase 2 : find additional evacuation points
			for (Pt t : circles) {
				// y = c + v * x;
				double x0 = t.x - sx;
				double y0 = t.y + sy;
				double a = -v;
				double b = 1;
				double c = a * x0 + b * y0;
				double len = Math.sqrt(sqr(a) + sqr(b));
				a /= len;
				b /= len;
				c /= len;
				double dn = a * u.x + b * u.y - c;
				if (Math.abs(dn) < r - EPS) {
					double dt = Math.sqrt(sqr(r) - sqr(dn));
					double x1 = u.x - dn * a + dt * b;
					double y1 = u.y - dn * b - dt * a;
					if (between(x1, u.x - sx, u.x + sx) && okPoint(x1, y1))
						u.kp.add(new Pt(x1, y1));
				}
			}
		}

		// build initial transition graph
		for (Circle u : circles)
			for (Pt t : u.kp)
				addFrom(t.x, t.y);

		// proceed with cycles
		double dmin = d;
		double result = Double.POSITIVE_INFINITY;
		
		for (int cycle = 0;; cycle++) {
			addFrom(0, dmin); // and tansitions from current max depth

			// find all possible starting points
			s.clear();
			q.clear();
			for (Pt p : g.pts.keySet())
				if (cmp(p.x, 0) == 0 && cmp(p.y, dmin) >= 0) {
					s.add(p);
					q.add(p);
				}

			double newdmin = dmin;

			// Breadth-first traversal of the graph
			while (!q.isEmpty()) {
				Pt p = q.removeFirst();
				if (cmp(p.x, 2 * w) == 0)
					newdmin = Math.min(newdmin, p.y);
				if (cmp(p.y, 0) == 0)
					result = Math.min(result, p.x + cycle * 2 * w);
				for (Pt t : g.pts.get(p))
					if (!s.contains(t)) {
						s.add(t);
						q.add(t);
					}
			}
			if (result < Double.POSITIVE_INFINITY)
				break;
			if (cmp(newdmin, dmin) == 0)
				break;
			dmin = newdmin;
		}

		// write output
		PrintWriter out = new PrintWriter("diver.out");
		if (result < Double.POSITIVE_INFINITY)
			out.println(result / vs);
		else
			out.println("IMPOSSIBLE");
		out.close();
	}

	private boolean okD(double d) {
		return cmp(d, r) >= 0;
	}

	private boolean okWrt(double x, double y, Pt u) {
		return okD(Math.sqrt(sqr(x - u.x) + sqr(y - u.y)));
	}

	private boolean okPoint(double x, double y) {
		if (cmp(x, 0) < 0 || cmp(x, 2 * w) > 0 || cmp(y, 0) < 0 || cmp(y, d) > 0)
			return false;
		for (Pt u : circles)
			if (!okWrt(x, y, u))
				return false;
		return true;
	}

	private boolean okLine(double x1, double y1, double x2, double y2) {
		if (!okPoint(x1, y1) || !okPoint(x2, y2))
			return false;
		double a = y1 - y2;
		double b = x2 - x1;
		double len = Math.sqrt(sqr(a) + sqr(b));
		if (len < EPS)
			return true;
		a /= len;
		b /= len;
		double c = a * x1 + b * y1;
		for (Pt u : circles) {
			double d0 = a * u.x + b * u.y - c;
			if (!okD(Math.abs(d0))) {
				double x0 = u.x - d0 * a;
				double y0 = u.y - d0 * b;
				if (between(x0, x1, x2) && between(y0, y1, y2))
					return false;
			}
		}
		return true;
	}

	// only works for segments going around the top of the circle u
	private boolean okSeg(double x1, double y1, double x2, double y2, Pt u) {
		if (!okPoint(x1, y1) || !okPoint(x2, y2))
			return false;
		// check intersection with circles
		for (Pt t: circles) {
			double vx = t.x - u.x;
			double vy = t.y - u.y;
			double len = Math.sqrt(sqr(vx) + sqr(vy));
			if (cmp(len, 2 * r) < 0) {
				double x3 = u.x + vx / 2;
				double y3 = u.y + vy / 2;
				if (cmp(y3, u.y) > 0 && between(x3, x1, x2))
					return false;
			}
		}
		// make sure there's no "deep dive" on this segment
		if (cmp(x1, u.x) <= 0 && cmp(x2, u.x) >= 0 && cmp(u.y + r, d) > 0)
			return false;
		return true;
	}

	private void addLine(double x1, double y1, double x2, double y2) {
		if (okLine(x1, y1, x2, y2))
		    g.add(new Pt(x1, y1), new Pt(x2, y2));
	}

	private void addCurve(double x1, double y1, Circle u) {
		// y = a1 - v * x;
		double a1 = y1 + v * x1;

		// y = a3 + v * x;
		double x3 = u.x - sx;
		double y3 = u.y + sy;
		double a3 = y3 - v * x3;

		// a1 - v * x = a3 + v * x
		double x2 = (a1 - a3) / (2 * v);
		double y2 = a1 - v * x2;

		// outside hit?
		if (cmp(x1, x2) <= 0 && cmp(x2, x3) <= 0 &&
			okLine(x1, y1, x2, y2) && okLine(x2, y2, x3, y3))
				for (Pt p4 : u.kp)
					if (cmp(x3, p4.x) <= 0 && okSeg(x3, y3, p4.x, p4.y, u))
						g.add(new Pt(x1, y1), p4);

		if (cmp(x2, x3) >= 0) {
			// hit top segment; intersect y = a1 - v * x with u circle
			double xn = v;
			double yn = 1;
			double cn = a1;
			double len = Math.sqrt(sqr(xn) + sqr(yn));
			xn /= len;
			yn /= len;
			cn /= len;
			double dn = cn - xn * u.x - yn * u.y;
			double dt = Math.sqrt(sqr(r) - sqr(dn));

			double x5 = u.x + dn * xn - dt * yn;
			double y5 = u.y + dn * yn + dt * xn;

			if (cmp(x1, x5) <= 0 && okLine(x1, y1, x5, y5))
				for (Pt p4 : u.kp)
					if (cmp(x5, p4.x) < 0 && okSeg(x5, y5, p4.x, p4.y, u))
						g.add(new Pt(x1, y1), p4);
		}
	}

	private void addFrom(double x, double y) {
		if (!okPoint(x, y))
			return;
		addLine(x, y, 2 * w, y - v * (2 * w - x));
		addLine(x, y, x + y / v, 0);
		addLine(0, y + v * x, x, y);
		for (Circle u : circles)
			addCurve(x, y, u);
	}

	private static double mod(double a, int b) {
		while (a < 0)
			a+= b;
		while (a >= b)
			a-= b;
		return a;
	}

	private static double sqr(double x) {
		return x * x;
	}

//----------------- just for validation ------------------

	/**
	 * Strict scanner to veryfy 100% correspondence between input files and input file format specification.
	 * It is a drop-in replacement for {@link java.util.Scanner} that could be added to a soulution source
	 * (cut-and-paste) without breaking its ability to work with {@link java.util.Scanner}.
	 */
	public class XScanner {
		private final BufferedReader in;
		private String line = "";
		private int pos;
		private int lineNo;
		private boolean localeset;

		public XScanner(File source) throws FileNotFoundException {
			in = new BufferedReader(new InputStreamReader(System.in));
			nextLine();
		}

		public void close() {
			assert line == null : "Extra data at the end of file";
			try {
				in.close();
			} catch (IOException e) {
				throw new AssertionError("Failed to close with " + e);
			}
		}

		public void nextLine() {
			assert line != null : "EOF";
			assert pos == line.length() : "Extra characters on line " + lineNo;
			try {
				line = in.readLine();
			} catch (IOException e) {
				throw new AssertionError("Failed to read line with " + e);
			}
			pos = 0;
			lineNo++;
		}

		public String next() {
			assert line != null : "EOF";
			assert line.length() > 0 : "Empty line " + lineNo;
			if (pos == 0)
				assert line.charAt(0) > ' ' : "Line " + lineNo + " starts with whitespace";
			else {
				assert pos < line.length() : "Line " + lineNo + " is over";
				assert line.charAt(pos) == ' ' : "Wrong whitespace on line " + lineNo;
				pos++;
				assert pos < line.length() : "Line " + lineNo + " is over";
				assert line.charAt(0) > ' ' : "Line " + lineNo + " has double whitespace";
			}
			StringBuilder sb = new StringBuilder();
			while (pos < line.length() && line.charAt(pos) > ' ')
				sb.append(line.charAt(pos++));
			return sb.toString();
		}

		public int nextInt() {
			String s = next();
			assert s.length() == 1 || s.charAt(0) != '0' : "Extra leading zero in number " + s + " on line " + lineNo;
			assert s.charAt(0) != '+' : "Extra leading '+' in number " + s + " on line " + lineNo;
			try {
				return Integer.parseInt(s);
			} catch (NumberFormatException e) {
				throw new AssertionError("Malformed number " + s + " on line " + lineNo);
			}
		}

		public double nextDouble() {
			assert localeset : "Locale must be set with useLocale(Locale.US)";
			String s = next();
			assert s.length() == 1 || s.startsWith("0.") || s.charAt(0) != '0' : "Extra leading zero in number " + s + " on line " + lineNo;
			assert s.charAt(0) != '+' : "Extra leading '+' in number " + s + " on line " + lineNo;
			try {
				return Double.parseDouble(s);
			} catch (NumberFormatException e) {
				throw new AssertionError("Malformed number " + s + " on line " + lineNo);
			}
		}

		public void useLocale(Locale locale) {
			assert locale == Locale.US;
			localeset = true;
		}
	}
}
