// Arup Guha
// 1/18/2018
// Solution to 2013 NAQ Problem: Trapezoid Walkway

import java.util.*;

public class walkway {

	public static int n;
	public static trap[] list;
	public static int[][] adj;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();

		// Process each case.
		while (n != 0) {

			// Read trapezoids.
			list = new trap[n];
			for (int i=0; i<n; i++) {
				int a = stdin.nextInt();
				int b = stdin.nextInt();
				int h = stdin.nextInt();
				list[i] = new trap(a,b,h);
			}

			int start = stdin.nextInt();
			int end = stdin.nextInt();

			// Going old school here adj matrix to store graph.
			adj = new int[2*n+1][2*n+1];

			// We do this separate for start vertex.
			Arrays.fill(adj[2*n], -1);
			adj[2*n][2*n] = 0;

			for (int i=0; i<2*n; i++) {

				// Regular connections.
				for (int j=0; j<2*n; j++) {
					if (i/2 == j/2) continue;

					// A connection.
					if (list[i/2].bases[i%2] == list[j/2].bases[j%2])
						adj[i][j] = list[j/2].dArea;

					// No connection mark with -1.
					else
						adj[i][j] = -1;
				}

				// Connection from source to first tile.
				if (list[i/2].bases[i%2] == start)
					adj[2*n][i] = list[i/2].dArea;
			}

			// Just run Dijkstra's here...being lazy.
			int[] d = new int[2*n+1];
			Arrays.fill(d, 2000000001);
			d[2*n] = 0;
			boolean[] used = new boolean[2*n+1];

			// Number of iterations for Dijkstra's.
			for (int i=0; i<2*n; i++) {

				// Find next best vertex.
				int index = -1;
				for (int j=0; j<=2*n; j++) {
					if (used[j]) continue;
					if (index == -1 || d[j] < d[index]) index = j;
				}

				used[index] = true;

				// Update all relevant distances.
				for (int j=0; j<=2*n; j++)
					if (adj[index][j] != -1)
						d[j] = Math.min(d[j], d[index]+adj[index][j]);
			}

			// Get double of result.
			int res = -1;
			if (start == end) res = 0;

			// Regular case.
			else {

				// Find shortest distance to a valid ending tile.
				for (int i=0; i<2*n; i++)
					if (list[i/2].bases[0] == end || list[i/2].bases[1] == end)
						if (res == -1 || d[i] < res)
							res = d[i];
			}

			// Ta da!
			System.out.printf("%.2f\n", res/100.0);
			n = stdin.nextInt();
		}
	}
}

class trap {

	public int[] bases;
	public int h;
	public int dArea;

	public trap(int mya, int myb, int myh) {
		bases = new int[2];
		bases[0] = mya;
		bases[1] = myb;
		h = myh;
		dArea = (bases[0]+bases[1])*myh;
	}

}