import java.util.Scanner;
public class oiergiv {
static class City{
int []x = new int[4];
int []y = new int[4];
int price;
public City(int x1, int y1, int x2, int y2, int x3, int y3, int price) {
x[0] = x1;
y[0] = y1;
x[1] = x2;
y[1] = y2;
x[2] = x3;
y[2] = y3;
double t12 = distance(x1,y1,x2,y2);
double t13 = distance(x1,y1,x3,y3);
double t23 = distance(x2,y2,x3,y3);
if(Math.abs(t12*t12+t13*t13-t23*t23)<0.000001){
x[3] = x2+x3-x1;
y[3] = y2+y3-y1;
}
if(Math.abs(t12*t12+t23*t23-t13*t13)<0.000001){
x[3] = x1+x3-x2;
y[3] = y1+y3-y2;
}
if(Math.abs(t13*t13+t23*t23-t12*t12)<0.000001){
x[3] = x1+x2-x3;
y[3] = y1+y2-y3;
}
this.price = price;
}
private double distance(int x12, int y12, int x22, int y22) {
return Math.sqrt((x22-x12)*(x22-x12)+(y22-y12)*(y22-y12));
}
}
static int s,t,A,B;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
s = sc.nextInt();
t = sc.nextInt();
A = sc.nextInt();
B = sc.nextInt();
double[][] price = new double[s*4][s*4];
City []cities = new City[s];
for (int i = 0; i < s; i++) {
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
int x3 = sc.nextInt();
int y3 = sc.nextInt();
int train_price = sc.nextInt();
City citys = new City(x1, y1, x2, y2, x3, y3, train_price);
cities[i] = citys;
}
for(int i = 0;i < s*4;i++){
for(int j = 0;j < s*4;j++){
if(i/4 == j/4){
price[i][j] = dist(cities[i/4].x[i%4],cities[i/4].y[i%4],cities[j/4].x[j%4],cities[j/4].y[j%4])*cities[i/4].price;
}else{
price[i][j] = dist(cities[i/4].x[i%4],cities[i/4].y[i%4],cities[j/4].x[j%4],cities[j/4].y[j%4])*t;
}
}
}
floyd(price);
double min = price[(A-1)*4][(B-1)*4];
for(int i = (A-1)*4; i < A*4; i++){
for(int j = (B-1)*4; j < B*4; j++){
min = Math.min(price[i][j],min);
}
}
System.out.printf("%.1f", min);
}
public static void floyd(double[][] price){
for (int k = 0; k < s*4; k++) {
for (int i = 0; i < s*4; i++) {
for (int j = 0; j < s*4; j++) {
price[i][j] = Math.min(price[i][j], price[i][k] + price[k][j]);
}
}
}
}
private static double dist(int x12, int y12, int x22, int y22) {
return Math.sqrt((x22-x12)*(x22-x12)+(y22-y12)*(y22-y12));
}
}