// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
const ll INF = (1LL << 62) - 1;
vector<ll> dijkstra(vector<vector<pair<ll, pair<ll, ll>>>> &G, ll v)
{
    vector<ll> ans(G.size(), INF);
    ans[v] = 0;
    priority_queue<pair<ll, ll>> que;
    que.push({0, v});
    while (!que.empty())
    {
        auto [x, u] = que.top();
        que.pop();
        if (-x > ans[u])
            continue;
        for (auto [v, w] : G[u])
        {
            auto [t, k] = w;
            ll s = 0;
            if (x)
                s = (-(x + 1) / k + 1) * k;
            if (s + t < ans[v])
                ans[v] = s + t, que.push({-ans[v], v});
        }
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, m, x, y;
    cin >> n >> m >> x >> y;
    x--;
    y--;
    vector<vector<pair<ll, pair<ll, ll>>>> g(n);
    while (m--)
    {
        ll a, b, k, t;
        cin >> a >> b >> t >> k;
        a--;
        b--;
        g[a].push_back({b, {t, k}});
        g[b].push_back({a, {t, k}});
    }
    auto d = dijkstra(g, x);
    cout << (d[y] < INF ? d[y] : -1);
}
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<map>
#include<cmath>
using namespace std;

#define LL long long
#define DB double
#define MAXN 400000
#define Pr pair<int,int>
#define X first
#define Y second
#define INF 1000000001
#define MOD 1000000007
#define eps 1e-8
#define mem(x,v) memset(x,v,sizeof(x))

LL read(){
    LL x=0,F=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*F;
}

int n,x[MAXN+5],y[MAXN+5],fa[MAXN+5];
int xfind(int x){return (fa[x]==x)?x:fa[x]=xfind(fa[x]);}

DB dist(int i,int j){
	return (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
}

void bin(int u,int v){
	int a=xfind(u),b=xfind(v);
	if(a==b)return ;
	fa[a]=b;
}

bool check(DB R){
	for(int i=0;i<=n+1;i++)fa[i]=i;
	for(int i=1;i<=n;i++)if(y[i]-2*R<-100)bin(0,i);
	for(int i=1;i<=n;i++)if(y[i]+2*R>100)bin(i,n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
		if(dist(i,j)<4*R*R)
		bin(i,j);
	return (xfind(0)==xfind(n+1));
}

int main(){
	n=read();
	for(int i=1;i<=n;i++)x[i]=read(),y[i]=read();
	DB l=0,r=100;
	while(l+eps<r){
		DB mid=(l+r)/2.0;
		if(!check(mid))l=mid;
		else r=mid;
	}
	printf("%.10f",l);
}