// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(ll i=(ll)s; i<(ll)(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    itval(++it, args...);
}
const ll MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {cout << x << "\n";}
template <typename T>
inline void printvec(T x) {for (auto a : x)cout << a << ' '; cout << '\n';}
// -----------------------------------------------------------------------

struct custom {
    bool operator()(const pair<int, pii> &p1, const pair<int, pii> &p2)const {
        if (p1.F == p2.F)
            return p1.S.F > p2.S.F;
        return p1.F > p2.F;
    }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b, ll M = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res * a) % M;
        a = (a * a) % M;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 1e5 + 5, inf = 2e18;
inline ll calc(ll x, ll c, ll d)
{

    return x + c + (d / (x + 1));
}


std::vector<pair<ll, pll>> adj[N];
void solve()
{
    ll n, m, x, y, c, d;
    cin >> n >> m;
    forn(i, 0, m)
    {
        cin >> x >> y >> c >> d;
        x--; y--;
        adj[x].pb({y, {c, d}});
        adj[y].pb({x, {c, d}});
    }
    std::vector<ll> dist(n, inf);
    dist[0] = 0;
    set<pll> s;
    ll z, k;
    s.insert({0, 0});
    while (!s.empty())
    {
        pll t = *s.begin();
        s.erase(s.begin());
        for (auto D : adj[t.S])
        {
            z = inf, k = sqrt(D.S.S);
            forn(j, -5, 5)
            {
                z = min(z, calc(max(t.F, k + j), D.S.F, D.S.S));
            }
            if (dist[D.F] >  z)
            {
                s.erase({dist[D.F], D.F});
                dist[D.F] =  z;
                s.insert({dist[D.F], D.F});
            }
        }
    }

    if (dist[n - 1] == inf)
        cout << -1;
    else
        cout << dist[n - 1];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int test = 1;
    clock_t z = clock();
    //cin >> test;

    forn(tes, 0, test)
    {

        solve();
    }
    debug("Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, p[105];
double x[105], y[105], dist[105][105], l, r, m;
bool out[105][105];
int find(int x){return (p[x] < 0 ? x : p[x] = find(p[x]));}
void uni(int x, int y){
	x = find(x); y = find(y);
	if(x != y){
		if(p[x] > p[y]) swap(x, y);
		p[x] += p[y];
		p[y] = x;
	}
}
int main(){
	scanf("%d", &n);
	rep(i,n){
		scanf("%lf%lf", x+i, y+i);
		rep(j,i) dist[i][j] = hypot(x[i]-x[j],y[i]-y[j]);
		dist[n][i] = abs(100-y[i]);
		dist[n+1][i] = abs(100+y[i]);
	}
	dist[n+1][n] = 200;
	l = 0, r = 200;
	while(r-l > 1e-6){
		m = (l+r) / 2;
		fill(p, p+n+2, -1);
		rep(i,n+2) rep(j,i) if(dist[i][j] < m) uni(i,j);
		(find(n) != find(n+1) ? l : r) = m;
	}
	printf("%f\n", m / 2);
}