					   // be name khoda //
#include<bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
typedef long long ll;

const int maxn = 1000 * 100 + 5;
int n; pair<double, double> m[maxn], v[maxn]; double t[maxn][4], javab = -1, x[2], y[2];

void input()
{
	cin >> n >> x[0] >> y[0] >> x[1] >> y[1];
	for(int i = 0; i < n; i++)
		cin >> m[i].x >> m[i].y >> v[i].x >> v[i].y;
}

double fx(double x, double y0, double y1, int an)
{
	if(m[an].x > x && v[an].x >= 0) return -1;
	if(m[an].x < x && v[an].x <= 0) return -1;
	if(y0 > y1) swap(y0, y1);
	double a = (x - m[an].x) / v[an].x; double aa = (m[an].y + v[an].y * a);
	if(y0 <= aa && y1 >= aa) return a;
	return -1;
}

double fy(double y, double x0, double x1, int an)
{
	if(m[an].y > y && v[an].y >= 0) return -1;
	if(m[an].y < y && v[an].y <= 0) return -1;
	if(x0 > x1) swap(x0, x1);
	double a = (y - m[an].y) / v[an].y; double aa = (m[an].x + v[an].x * a);
	if(x0 <= aa && x1 >= aa) return a;
	return -1;
}

void solved()
{
	double minn = 0;
	for(int i = 0; i < n; i++)
	{
		t[i][0] = fx(x[0], y[0], y[1], i); t[i][1] = fx(x[1], y[0], y[1], i);
		t[i][2] = fy(y[0], x[0], x[1], i); t[i][3] = fy(y[1], x[0], x[1], i);
		sort(t[i], t[i] + 4);
		if(m[i].x >= min(x[0], x[1]) && m[i].x <= max(x[0], x[1]) && m[i].y >= min(y[0], y[1]) && m[i].y <= max(y[0], y[1]))
			t[i][2] = 0;
		else if(n == 100)
		{
			cout << i << " " << t[i][0] << " " << t[i][1] << " " << t[i][2] << " " << t[i][3] << endl;
		}
		if(t[i][3] == -1 || t[i][2] == -1) return;
		if(t[i][1] > -1) swap(t[i][1], t[i][2]);
		minn = max((double) t[i][2], (double) minn);
	}
	for(int i = 0; i < n; i++)
		if((double) t[i][3] < (double) minn)
			return;
	javab = minn;
}

void output()
{
	if(javab == -1) cout << javab << endl;
	else cout << fixed << setprecision(6) << javab << endl;
}

int main()
{
	input();
	solved();
	output();
	return 0;
}


					   // be name khoda //
#include<bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
typedef long long ll;

const int maxn = 1000 * 100 + 5;
int n; pair<double, double> m[maxn], v[maxn]; double t[maxn][4], javab = -1, x[2], y[2];

void input()
{
	scanf("%d %lf %lf %lf %lf", &n, &x[0], &y[0], &x[1], &y[1]);
	for(int i = 0; i < n; i++)
		scanf("%lf %lf %lf %lf", &m[i].x, &m[i].y, &v[i].x, &v[i].y);
}

double fx(double x, double y0, double y1, int an)
{
	if(m[an].x >= x && v[an].x >= 0) return -1;
	if(m[an].x <= x && v[an].x <= 0) return -1;
	if(m[an].y >= max(y0, y1) && v[an].y >= 0) return -1;
	if(m[an].y <= min(y0, y1) && v[an].y <= 0) return -1;
	if(y0 > y1) swap(y0, y1);
	double a = (x - m[an].x) / v[an].x; double aa = (m[an].y + v[an].y * a);
	if(y0 <= aa && y1 >= aa) return a;
	return -1;
}

double fy(double y, double x0, double x1, int an)
{
	if(m[an].y >= y && v[an].y >= 0) return -1;
	if(m[an].y <= y && v[an].y <= 0) return -1;
	if(m[an].x >= max(x0, x1) && v[an].x >= 0) return -1;
	if(m[an].x <= min(x0, x1) && v[an].x <= 0) return -1;
	if(x0 > x1) swap(x0, x1);
	double a = (y - m[an].y) / v[an].y; double aa = (m[an].x + v[an].x * a);
	if(x0 <= aa && x1 >= aa) return a;
	return -1;
}

void solved()
{
	double minn = 0;
	for(int i = 0; i < n; i++)
	{
		t[i][0] = fx(x[0], y[0], y[1], i); t[i][1] = fx(x[1], y[0], y[1], i);
		t[i][2] = fy(y[0], x[0], x[1], i); t[i][3] = fy(y[1], x[0], x[1], i);
		sort(t[i], t[i] + 4);
		if(m[i].x >= min(x[0], x[1]) && m[i].x <= max(x[0], x[1]) && m[i].y >= min(y[0], y[1]) && m[i].y <= max(y[0], y[1]))
			t[i][2] = 0;
if(m[i].x>min(x[0], x[1]) && m[i].x < max(x[0], x[1]) && m[i].y > min(y[0], y[1]) && m[i].y < max(y[0], y[1]) && v[i].x == 0 && v[i].y == 0)
	{
		t[i][0] = 0; t[i][1] = 0; t[i][2] = 0; t[i][3] = 1000 * 1000 * 100;
	}
		if(t[i][1] > -1) swap(t[i][1], t[i][2]);
		if(t[i][3] == -1 || t[i][2] == -1 || t[i][2] == t[i][3])
			return;
		minn = max((double) t[i][2], (double) minn);
	}
	for(int i = 0; i < n; i++)
		if((double) t[i][3] < (double) minn)
		{
			cout << i << endl;
			return;
		}
	javab = minn;
}

void output()
{
	if(javab == -1) cout << javab << endl;
	else cout << fixed << setprecision(6) << javab << endl;
}

int main()
{
	input();
	solved();
	output();
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const double inf=1e6;

int i,n,x1,y1,x2,y2,mx,my,vx,vy;
double l,r;

int main()
{
	scanf("%d",&n);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	l=-inf,r=inf;
	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d%d",&mx,&my,&vx,&vy);
		if ((! vx) && ((mx<x1) || (mx>x2))) return printf("-1"),0;
		if ((! vy) && ((my<y1) || (my>y2))) return printf("-1"),0;
		l=max(l,min(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx)),r=min(r,max(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx));
		l=max(l,min(1.0*(y1-my)/vy,1.0*(y2-my)/vy)),r=min(r,max(1.0*(y1-my)/vy,1.0*(y2-my)/vy));
	}
	if ((l>r) || (r<0))
		printf("-1");
	else
		if (l<0)
			printf("%.20lf",0);
		else
			printf("%.20lf",l);
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const double inf=1e6;

int i,n,x1,y1,x2,y2,mx,my,vx,vy;
double l,r;

int main()
{
	scanf("%d",&n);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	l=1e-12,r=inf;
	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d%d",&mx,&my,&vx,&vy);
		if ((! vx) && ((mx<=x1) || (mx>=x2))) return printf("-1"),0;
		if ((! vy) && ((my<=y1) || (my>=y2))) return printf("-1"),0;
		l=max(l,min(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx)),r=min(r,max(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx));
		l=max(l,min(1.0*(y1-my)/vy,1.0*(y2-my)/vy)),r=min(r,max(1.0*(y1-my)/vy,1.0*(y2-my)/vy));
	}
	if (l>r)
		printf("-1");
	else
		printf("%.20lf",l);
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const double inf=1e6;

int i,n,x1,y1,x2,y2,mx,my,vx,vy;
double l,r;

int main()
{
	scanf("%d",&n);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	l=1e-12,r=inf;
	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d%d",&mx,&my,&vx,&vy);
		if ((! vx) && ((mx<=x1) || (mx>=x2))) return printf("-1"),0;
		if ((! vy) && ((my<=y1) || (my>=y2))) return printf("-1"),0;
		l=max(l,min(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx)),r=min(r,max(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx));
		l=max(l,min(1.0*(y1-my)/vy,1.0*(y2-my)/vy)),r=min(r,max(1.0*(y1-my)/vy,1.0*(y2-my)/vy));
	}
	if (l>=r)
		printf("-1");
	else
		printf("%.20lf",l);
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const double inf=1e6;

int i,n,x1,y1,x2,y2,mx,my,vx,vy;
double l,r;

int main()
{
	scanf("%d",&n);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	l=-inf,r=inf;
	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d%d",&mx,&my,&vx,&vy);
		l=max(l,min(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx)),r=min(r,max(1.0*(x1-mx)/vx,1.0*(x2-mx)/vx));
		l=max(l,min(1.0*(y1-my)/vy,1.0*(y2-my)/vy)),r=min(r,max(1.0*(y1-my)/vy,1.0*(y2-my)/vy));
	}
	if ((l>r) || (r<0))
		printf("-1");
	else
		printf("%.20lf",l);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	for(i = 0; i < n; i++){
		if(t[i] < time){
			fx = rx + time * vx;
			fy = ry + time * vy;
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		tn = max(tx, ty);
		t[i] = tn;
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	for(i = 0; i < n; i++){
		fx = rx + time * vx;
		fy = ry + time * vy;
		if(fx > x2 || fx < x1 || fy > y2 || fy < y1){
			cout << -1;
			return 0;
		}
	}
	cout << fixed << setprecision(10) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	if(x1 == x2 || y1 == y2){
		cout << -1;
		return 0;
	}
	vector<ld> t(n);
	vector<vector<int> > s(n, vector<int>(2));
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		s[i][0] = vx;
		s[i][1] = vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			tx = 0.0;
			ty = 0.0;
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	//cout << fixed << setprecision(20) << time;
	for(i = 0; i < n; i++){
		if(t[i] < time){
			fx = rx + time * s[i][0];
			//cout << fixed << setprecision(10) << time *  << endl;
			fy = ry + time * s[i][1];
			//cout << (ld)fy << endl;
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		tn = max(tx, ty);
		fx = rx + tn * vx;
		fy = ry + tn * vy;
		if(fx <= x2 && fx >=x1 && fy <= y2 && fy >= y1){
			t[i] = tn;
		}
		else{
			cout << -1;
			return 0;
		}
	}
	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	cout << fixed << setprecision(10) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			tx = 0.0;
			ty = 0.0;
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	for(i = 0; i < n; i++){
		if(t[i] < time){
			fx = rx + time * vx;
			fy = ry + time * vy;
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		tn = max(tx, ty);
		fx = rx + tn * vx;
		fy = ry + tn * vy;
		if(fx <= x2 && fx >=x1 && fy <= y2 && fy >= y1){
			t[i] = tn;
		}
		else if(fx > x2 || fx < x1 || fy > y2 || fy < y1){
			cout << -1;
			return 0;
		}
	}
	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	cout << fixed << setprecision(10) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	if(time == 0){
		cout << fixed << setprecision(20) << time;
		return 0;
	}
	for(i = 0; i < n; i++){
		fx = rx + time * vx;
		fy = ry + time * vy;
		if(t[i] < time){
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			tx = 0.0;
			ty = 0.0;
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	for(i = 0; i < n; i++){
		if(t[i] < time){
			fx = rx + time * vx;
			fy = ry + time * vy;
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	if(x1 == x2 || y1 == y2){
		cout << -1;
		return 0;
	}
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			tx = 0.0;
			ty = 0.0;
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	for(i = 0; i < n; i++){
		if(t[i] < time){
			fx = rx + time * vx;
			fy = ry + time * vy;
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	if(x1 == x2 || y1 == y2){
		cout << -1;
		return 0;
	}
	vector<ld> t(n);
	vector<vector<int> > s(n, vector<int>(4));
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		s[i][0] = rx;
		s[i][1] = ry;
		s[i][2] = vx;
		s[i][3] = vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			tx = 0.0;
			ty = 0.0;
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		//cout << t[i] << endl;
		if(time < t[i]){
			time = t[i];
		}
	}
	//cout << fixed << setprecision(20) << time;
	for(i = 0; i < n; i++){
		if(t[i] < time){
			fx = s[i][0] + time * s[i][2];
			//cout << fx  << endl;
			fy = s[i][1] + time * s[i][3];
			//cout << fy << endl;
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				//cout << i << endl;
				//cout << t[i] << endl;
				//cout << fx << endl;
				//cout << fy << endl;
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(20) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		if(tx < ty){
			fx = rx + ty * vx;
			if(fx > x1 && fx < x2){
				t[i] = ty;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx > ty){
			fy = ry + tx * vy;
			if(fy > y1 && fy < y2){
				t[i] = tx;
			}
			else{
				cout << -1;
				return 0;
			}
		}
		else if(tx == ty){
			t[i] = tx;
		}
	}

	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	if(time == 0){
		cout << fixed << setprecision(10) << time;
		return 0;
	}
	for(i = 0; i < n; i++){
		fx = rx + time * vx;
		fy = ry + time * vy;
		if(t[i] < time){
			if(fx >= x2 || fx <= x1 || fy >= y2 || fy <= y1){
				cout << -1;
				return 0;
			}
		}
	}
	cout << fixed << setprecision(10) << time;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	int n;
	cin >> n;
	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	vector<ld> t(n);
	int i;
	int rx, ry, vx, vy;
	ld fx, fy, tx, ty, tn;
	for(i = 0; i < n; i++){
		cin >> rx >> ry >> vx >> vy;
		if(rx < x2 && rx > x1 && ry < y2 && ry > y1){
			t[i] = 0.0;
		}
		else{
			if(rx <= x1){
				if(vx > 0){
					tx = (ld)(x1 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(rx >= x2){
				if(vx < 0){
					tx = (ld)(x2 - rx) / vx;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			if(ry <= y1){
				if(vy > 0){
					ty = (ld)(y1 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
			else if(ry >= y2){
				if(vy < 0){
					ty = (ld)(y2 - ry) / vy;
				}
				else{
					cout << -1;
					return 0;
				}
			}
		}
		tn = max(tx, ty);
		fx = rx + tn * vx;
		fy = ry + tn * vy;
		if(fx <= x2 && fx >=x1 && fy <= y2 && fy >= y1){
			t[i] = tn;
		}
	}
	ld time = 0.0;
	for(i = 0; i < n; i++){
		if(time < t[i]){
			time = t[i];
		}
	}
	cout << fixed << setprecision(10) << time;
	return 0;
}


#include<iostream>

using namespace std;

int main()
{
    int n,i,x1,y1,x2,y2,rx,ry,vx,vy;
    double tl,tr;
    while(cin>>n)
    {
        tl=0,tr=(double)0x3fffffff;
        cin>>x1>>y1>>x2>>y2;
        for (i=1;i<=n;i++)
        {
            cin>>rx>>ry>>vx>>vy;
            if (rx>=x2)
            {
                if (vx>0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(x2-rx)/vx);
                tr=min(tr,(double)(x1-rx)/vx);

                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else if (rx<=x1)
            {
                if (vx<0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(x1-rx)/vx);
                tr=min(tr,(double)(x2-rx)/vx);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else
            {
                tr=min(tr,max((double)(x1-rx)/vx,(double)(x2-rx)/vx));
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }

            if (ry>=y2)
            {
                if (vy>0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(y2-ry)/vy);
                tr=min(tr,(double)(y1-ry)/vy);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else if (ry<=y1)
            {
                if (vy<0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(y1-ry)/vy);
                tr=min(tr,(double)(y2-ry)/vy);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else
            {
                tr=min(tr,max((double)(y1-ry)/vy,(double)(y2-ry)/vy));
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
        }
        cout<<tl<<endl;
    }
}


#include<iostream>

using namespace std;

int main()
{
    int n,i,rx,ry,vx,vy;
    double tl,tr,x1,y1,x2,y2;
    while(cin>>n)
    {
        tl=0,tr=(double)0x3fffffff;
        cin>>x1>>y1>>x2>>y2;
        x1+=0.00000000001;x2-=0.00000000001;y1+=0.00000000001;y2-=0.00000000001;
        for (i=1;i<=n;i++)
        {
            cin>>rx>>ry>>vx>>vy;
            if (rx>=x2)
            {
                if (vx>=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(x2-rx)/vx);
                tr=min(tr,(double)(x1-rx)/vx);

                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else if (rx<=x1)
            {
                if (vx<=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(x1-rx)/vx);
                tr=min(tr,(double)(x2-rx)/vx);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else
            {
                tr=min(tr,max((double)(x1-rx)/vx,(double)(x2-rx)/vx));
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }

            if (ry>=y2)
            {
                if (vy>=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(y2-ry)/vy);
                tr=min(tr,(double)(y1-ry)/vy);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else if (ry<=y1)
            {
                if (vy<=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(y1-ry)/vy);
                tr=min(tr,(double)(y2-ry)/vy);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else
            {
                tr=min(tr,max((double)(y1-ry)/vy,(double)(y2-ry)/vy));
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
        }
        cout<<tl<<endl;
    }
}


#include<iostream>

using namespace std;

int main()
{
    int n,i,x1,y1,x2,y2,rx,ry,vx,vy;
    double tl,tr;
    while(cin>>n)
    {
        tl=0,tr=(double)0x3fffffff;
        cin>>x1>>y1>>x2>>y2;
        for (i=1;i<=n;i++)
        {
            cin>>rx>>ry>>vx>>vy;
            if (rx>=x2)
            {
                if (vx>=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(x2-rx)/vx);
                tr=min(tr,(double)(x1-rx)/vx);

                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else if (rx<=x1)
            {
                if (vx<=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(x1-rx)/vx);
                tr=min(tr,(double)(x2-rx)/vx);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else
            {
                tr=min(tr,max((double)(x1-rx)/vx,(double)(x2-rx)/vx));
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }

            if (ry>=y2)
            {
                if (vy>=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(y2-ry)/vy);
                tr=min(tr,(double)(y1-ry)/vy);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else if (ry<=y1)
            {
                if (vy<=0)
                {
                    cout<<-1<<endl;
                    return 0;
                }
                tl=max(tl,(double)(y1-ry)/vy);
                tr=min(tr,(double)(y2-ry)/vy);
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
            else
            {
                tr=min(tr,max((double)(y1-ry)/vy,(double)(y2-ry)/vy));
                if (tr<tl)
                {
                    cout<<-1<<endl;
                    return 0;
                }
            }
        }
        cout<<tl<<endl;
    }
}


#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int INF = 1e9 + 10;
const double eps = 1e-15;

int N;
int x1, y1, x2, y2;

void cant() {
	printf("-1\n");
	exit(0);
}

double L = 0, R = INF;

void solve(int x, int v, int l, int r) {
	if (v == 0) {
		if (x <= l || x >= r) cant();
		return;
	}

	double t1 = double(l-x)/double(v);
	double t2 = double(r-x)/double(v);
	if (t1 > t2) swap(t1, t2);

	L = max(L, t1);
	R = min(R, t2);
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		solve(rx, vx, x1, x2);
		solve(ry, vy, y1, y2);
	}

	//printf("%lf %lf\n", L, R);
	if (L - eps > R) cant();
	printf("%lf\n", L);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int INF = 1e9 + 10;
const double eps = 1e-15;

int N;
int x1, y1, x2, y2;

void cant() {
	printf("-1\n");
	exit(0);
}

double L = 0, R = INF;

void solve(int x, int v, int l, int r) {
	if (v == 0) {
		if (x <= l || x >= r) cant();
		return;
	}

	double t1 = double(l-x)/double(v);
	double t2 = double(r-x)/double(v);
	if (t1 > t2) swap(t1, t2);

	L = max(L, t1);
	R = min(R, t2);
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		solve(rx, vx, x1, x2);
		solve(ry, vy, y1, y2);
	}

	//printf("%lf %lf\n", L, R);
	if (L + eps > R) cant();
	printf("%lf\n", L);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

typedef long long LL;

const int INF = 1e9 + 10;
const int kM = 2000 + 10;

struct Edge {
	int u, v, c;
	bool operator < (const Edge &e) const {
		if (u != e.u) return u < e.u;
		if (v != e.v) return v < e.v;
		return c < e.c;
	}
};

int N, K, M;
//Edge es[kM];

int f[85][85][85][2];
bool vis[85][85][85][2];
vector<Edge> G[85][2];

int solve (int l, int r, int k, int d) {
	if (l > r) return INF;
	if (k == 0) return 0;
	if (vis[l][r][k][d]) return f[l][r][k][d];

	int ans = INF;
	if (d == 0) {
		for (int i = 0; i < G[l][d].size(); i++) {
			Edge &e = G[l][d][i];
			if (e.v > r) break;
			ans = min(ans, e.c + solve(l+1, e.v, k-1, d^1));
			ans = min(ans, e.c + solve(e.v, r, k-1, d));
		}
	} else {
		for (int i = 0; i < G[r][d].size(); i++) {
			Edge &e = G[r][d][i];
			if (e.v < l) break;
			ans = min(ans, e.c + solve(e.v, r-1, k-1, d^1));
			ans = min(ans, e.c + solve(l, e.v, k-1, d));
		}
	}

	vis[l][r][k][d] = true;
	f[l][r][k][d] = ans;
	//printf("l = %d r = %d k = %d d = %d ans = %d\n", l, r, k, d, ans);
	return ans;
}

int main() {
	scanf("%d %d", &N, &K);
	scanf("%d", &M);

	for (int i = 1; i <= M; i++) {
		int u, v, c; scanf("%d %d %d", &u, &v, &c);
		Edge e = (Edge) {u, v, c};
		if (u == v) continue;

		if (u < v) G[u][0].push_back(e);
		else G[u][1].push_back(e);
	}
	for (int i = 1; i <= N; i++) {
		sort(G[i][0].begin(), G[i][0].end());
		sort(G[i][1].begin(), G[i][1].end());
		reverse(G[i][1].begin(), G[i][1].end());
	}

	int ans = INF;
	for (int i = 1; i <= N; i++) {
		ans = min(ans, solve(i, N, K-1, 0));
		ans = min(ans, solve(1, i, K-1, 1));
	}
	if (ans == INF) printf("-1\n");
	else printf("%d\n", ans);

	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

const double INF = 1e9 + 10;
const double eps = 1e-8;

typedef long long LL;

int N;
int X1, Y1, X2, Y2;

void cant() {
	printf("-1\n");
	exit(0);
}

bool find_ins_v(int rx, int ry, int vx, int vy, int x1, int y1, int y2, double &t) {
	if (vx == 0) {
		if (rx <= X1 || rx >= X2) cant();
		else {
			return false;
		}
	}

	t = double(x1 - rx) / double(vx);

	if (t + eps < 0) return false;

	double y = ry + t * vy;
	if (y1 - eps < y && y < y2 + eps) return true;
	return false;
}

bool find_ins_h(int rx, int ry, int vx, int vy, int x1, int x2, int y1, double &t) {
	if (vy == 0) {
		if (ry <= Y1 || ry >= Y2) cant();
		else {
			return false;
		}
	}

	t = double(y1 - ry) / double(vy);
	if (t + eps < 0) return false;

	double x = rx + t * vx;
	if (x1 - eps < x && x < x2 + eps) return true;
	return false;
}

void find_ins_t(int rx, int ry, int vx, int vy, double &t1, double &t2) {
	vector<double> ts;
	bool vz = vx == 0 and vy == 0;
	bool in = X1 < rx && rx < X2 && Y1 < ry && ry < Y2;

	//if (in) return;

	if (vz) {
		if (in) {
			t1 = 0;
			t2 = INF;
		} else {
			t1 = t2 = -1;
		}
		return;
	}

	if (in) {
		ts.push_back(0);
	}

	double tmp;
	if (find_ins_v(rx, ry, vx, vy, X1, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_v(rx, ry, vx, vy, X2, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y1, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y2, tmp)) {
		ts.push_back(tmp);
	}

	sort(ts.begin(), ts.end());
	for (int i = 0; i < ts.size(); i++) {
		double t = ts[i];
		if (t1 + eps < 0) {
			t1 = t;
		} else if (fabs(t1 - t) > eps) {
			t2 = t;
		}
	}
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2);

	double mi = -INF;
	double mx = INF;

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		double t1= -1, t2 = -1;

		find_ins_t(rx, ry, vx, vy, t1, t2);
		if (t1 < -eps || t2 < -eps) {
			printf("-1\n");
			return 0;
		}

		//printf("%lf %lf\n", t1, t2);

		mi = max(mi, t1);
		mx = min(mx, t2);
	}

	if (mi + eps < mx) {
		printf("%lf\n", mi);
	} else cant();

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int INF = 1e9 + 10;
const double eps = 1e-8;

int N;
int x1, y1, x2, y2;

void cant() {
	printf("-1\n");
	exit(0);
}

double L = 0, R = INF;

void solve(int x, int v, int l, int r) {
	if (v == 0) {
		if (x <= l || x >= r) cant();
		return;
	}

	double t1 = double(l-x)/double(v);
	double t2 = double(r-x)/double(v);
	if (t1 > t2) swap(t1, t2);

	L = max(L, t1);
	R = min(R, t2);
}

int main() {
	freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		solve(rx, vx, x1, x2);
		solve(ry, vy, y1, y2);
	}

	//printf("%lf %lf\n", L, R);
	if (L - eps > R) cant();
	printf("%lf\n", L);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

const double INF = 1e9 + 10;
const double eps = 1e-8;

typedef long long LL;

int N;
int X1, Y1, X2, Y2;

bool find_ins_v(int rx, int ry, int vx, int vy, int x1, int y1, int y2, double &t) {
	if (vx == 0) {
		if (rx != x1) return false;
		else t = 0;
	} else t = double(x1 - rx) / double(vx);

	if (t + eps < 0) return false;

	double y = ry + t * vy;
	if (y1 - eps < y && y < y2 + eps) return true;
	return false;
}

bool find_ins_h(int rx, int ry, int vx, int vy, int x1, int x2, int y1, double &t) {
	if (vy == 0) {
		if (ry != y1) return false;
		else t = 0;
	} else t = double(y1 - ry) / double(vy);
	if (t + eps < 0) return false;

	double x = rx + t * vx;
	if (x1 - eps < x && x < x2 + eps) return true;
	return false;
}

void find_ins_t(int rx, int ry, int vx, int vy, double &t1, double &t2) {
	vector<double> ts;
	bool vz = vx == 0 and vy == 0;
	bool in = X1 <= rx && rx <= X2 && Y1 <= ry && ry <= Y2;

	if (vz) {
		if (in) {
			t1 = 0;
			t2 = INF;
		} else {
			t1 = t2 = -1;
		}
		return;
	}

	if (in) {
		ts.push_back(0);
	}

	double tmp;
	if (find_ins_v(rx, ry, vx, vy, X1, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_v(rx, ry, vx, vy, X2, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y1, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y2, tmp)) {
		ts.push_back(tmp);
	}

	sort(ts.begin(), ts.end());
	for (int i = 0; i < ts.size(); i++) {
		double t = ts[i];
		if (t1 + eps < 0) {
			t1 = t;
		} else if (fabs(t1 - t) > eps) {
			t2 = t;
		}
	}
}

int main() {
//	/freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2);

	double mi = -INF;
	double mx = INF;

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		double t1= -1, t2 = -1;

		find_ins_t(rx, ry, vx, vy, t1, t2);
		if (t1 < -eps || t2 < -eps) {
			printf("-1\n");
			return 0;
		}

		mi = max(mi, t1);
		mx = min(mx, t2);
	}

	if (mi + eps < mx) {
		printf("%lf\n", mi);
	}

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

const double INF = 1e9 + 10;
const double eps = 1e-8;

typedef long long LL;

int N;
int X1, Y1, X2, Y2;

bool find_ins_v(int rx, int ry, int vx, int vy, int x1, int y1, int y2, double &t) {
	if (vx == 0) {
		if (rx != x1) return false;
		else t = 0;
	} else t = double(x1 - rx) / double(vx);

	if (t + eps < 0) return false;

	double y = ry + t * vy;
	if (y1 - eps < y && y < y2 + eps) return true;
	return false;
}

bool find_ins_h(int rx, int ry, int vx, int vy, int x1, int x2, int y1, double &t) {
	if (vy == 0) {
		if (ry != y1) return false;
		else t = 0;
	} else t = double(y1 - ry) / double(vy);
	if (t + eps < 0) return false;

	double x = rx + t * vx;
	if (x1 - eps < x && x < x2 + eps) return true;
	return false;
}

void find_ins_t(int rx, int ry, int vx, int vy, double &t1, double &t2) {
	vector<double> ts;
	bool vz = vx == 0 and vy == 0;
	bool in = X1 <= rx && rx <= X2 && Y1 <= ry && ry <= Y2;

	if (in) return;

	if (vz) {
		if (in) {
			t1 = 0;
			t2 = INF;
		} else {
			t1 = t2 = -1;
		}
		return;
	}

	if (in) {
		ts.push_back(0);
	}

	double tmp;
	if (find_ins_v(rx, ry, vx, vy, X1, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_v(rx, ry, vx, vy, X2, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y1, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y2, tmp)) {
		ts.push_back(tmp);
	}

	sort(ts.begin(), ts.end());
	for (int i = 0; i < ts.size(); i++) {
		double t = ts[i];
		if (t1 + eps < 0) {
			t1 = t;
		} else if (fabs(t1 - t) > eps) {
			t2 = t;
		}
	}
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2);

	double mi = -INF;
	double mx = INF;

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		double t1= -1, t2 = -1;

		find_ins_t(rx, ry, vx, vy, t1, t2);
		if (t1 < -eps || t2 < -eps) {
			printf("-1\n");
			return 0;
		}

		//printf("%lf %lf\n", t1, t2);

		mi = max(mi, t1);
		mx = min(mx, t2);
	}

	if (mi + eps < mx) {
		printf("%lf\n", mi);
	}

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

const double INF = 1e9 + 10;
const double eps = 1e-8;

typedef long long LL;

int N;
int X1, Y1, X2, Y2;

bool find_ins_v(int rx, int ry, int vx, int vy, int x1, int y1, int y2, double &t) {
	if (vx == 0) {
		if (rx != x1) return false;
		else t = 0;
	} else t = double(x1 - rx) / double(vx);

	if (t + eps < 0) return false;

	double y = ry + t * vy;
	if (y1 - eps < y && y < y2 + eps) return true;
	return false;
}

bool find_ins_h(int rx, int ry, int vx, int vy, int x1, int x2, int y1, double &t) {
	if (vy == 0) {
		if (ry != y1) return false;
		else t = 0;
	} else t = double(y1 - ry) / double(vy);
	if (t + eps < 0) return false;

	double x = rx + t * vx;
	if (x1 - eps < x && x < x2 + eps) return true;
	return false;
}

void find_ins_t(int rx, int ry, int vx, int vy, double &t1, double &t2) {
	vector<double> ts;
	bool vz = vx == 0 and vy == 0;
	bool in = X1 <= rx && rx <= X2 && Y1 <= ry && ry <= Y2;

	if (vz) {
		if (in) {
			t1 = -1;
			t2 = INF;
		} else {
			t1 = t2 = -1;
		}
		return;
	}

	if (in) {
		ts.push_back(0);
	}

	double tmp;
	if (find_ins_v(rx, ry, vx, vy, X1, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_v(rx, ry, vx, vy, X2, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y1, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y2, tmp)) {
		ts.push_back(tmp);
	}

	sort(ts.begin(), ts.end());
	for (int i = 0; i < ts.size(); i++) {
		double t = ts[i];
		if (t1 + eps < 0) {
			t1 = t;
		} else if (fabs(t1 - t) > eps) {
			t2 = t;
		}
	}
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2);

	double mi = -INF;
	double mx = INF;

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		double t1= -1, t2 = -1;

		find_ins_t(rx, ry, vx, vy, t1, t2);
		if (t1 < -eps || t2 < -eps) {
			printf("-1\n");
			return 0;
		}

		//printf("%lf %lf\n", t1, t2);

		mi = max(mi, t1);
		mx = min(mx, t2);
	}

	if (mi + eps < mx) {
		printf("%lf\n", mi);
	}

	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

const double INF = 1e9 + 10;
const double eps = 1e-8;

typedef long long LL;

int N;
int X1, Y1, X2, Y2;

void cant() {
	printf("-1\n");
	exit(0);
}

bool find_ins_v(int rx, int ry, int vx, int vy, int x1, int y1, int y2, double &t) {
	if (vx == 0) {
		if (rx <= X1 || rx >= X2) cant();
		else {
			return false;
		}
	}

	t = double(x1 - rx) / double(vx);

	if (t + eps < 0) return false;

	double y = ry + t * vy;
	if (y1 - eps < y && y < y2 + eps) return true;
	return false;
}

bool find_ins_h(int rx, int ry, int vx, int vy, int x1, int x2, int y1, double &t) {
	if (vy == 0) {
		if (ry <= Y1 || ry >= Y2) cant();
		else {
			return false;
		}
	}

	t = double(y1 - ry) / double(vy);
	if (t + eps < 0) return false;

	double x = rx + t * vx;
	if (x1 - eps < x && x < x2 + eps) return true;
	return false;
}

void find_ins_t(int rx, int ry, int vx, int vy, double &t1, double &t2) {
	vector<double> ts;
	bool vz = vx == 0 and vy == 0;
	bool in = X1 < rx && rx < X2 && Y1 < ry && ry < Y2;

	//if (in) return;

	if (vz) {
		if (in) {
			t1 = 0;
			t2 = INF;
		} else {
			t1 = t2 = -1;
		}
		return;
	}

	if (in) {
		ts.push_back(0);
	}

	double tmp;
	if (find_ins_v(rx, ry, vx, vy, X1, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_v(rx, ry, vx, vy, X2, Y1, Y2, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y1, tmp)) {
		ts.push_back(tmp);
	}
	if (find_ins_h(rx, ry, vx, vy, X1, X2, Y2, tmp)) {
		ts.push_back(tmp);
	}

	sort(ts.begin(), ts.end());
	for (int i = 0; i < ts.size(); i++) {
		double t = ts[i];
		if (t1 + eps < 0) {
			t1 = t;
		} else if (fabs(t1 - t) > eps) {
			t2 = t;
		}
	}
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &X1, &Y1, &X2, &Y2);

	double mi = -INF;
	double mx = INF;

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		double t1= -1, t2 = -1;

		find_ins_t(rx, ry, vx, vy, t1, t2);
		if (t1 < -eps || t2 < -eps) {
			printf("-1\n");
			return 0;
		}

		//printf("%lf %lf\n", t1, t2);

		mi = max(mi, t1);
		mx = min(mx, t2);
	}

	if (mi + eps < mx) {
		printf("%lf\n", mi);
	}

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int INF = 1e9 + 10;
const double eps = 1e-8;

int N;
int x1, y1, x2, y2;

void cant() {
	printf("-1\n");
	exit(0);
}

double L = -INF, R = INF;

void solve(int x, int v, int l, int r) {
	if (v == 0) {
		if (x <= l || x >= r) cant();
		return;
	}

	double t1 = double(l-x)/double(v);
	double t2 = double(r-x)/double(v);

	L = max(L, t1);
	R = min(R, t2);
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		solve(rx, vx, x1, x2);
		solve(ry, vy, y1, y2);
	}

	if (L + eps > R) cant();
	printf("%lf\n", L);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int INF = 1e9 + 10;
const double eps = 1e-8;

int N;
int x1, y1, x2, y2;

void cant() {
	printf("-1\n");
	exit(0);
}

double L = 0, R = INF;

void solve(int x, int v, int l, int r) {
	if (v == 0) {
		if (x <= l || x >= r) cant();
		return;
	}

	double t1 = double(l-x)/double(v);
	double t2 = double(r-x)/double(v);
	if (t1 > t2) swap(t1, t2);

	L = max(L, t1);
	R = min(R, t2);
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		solve(rx, vx, x1, x2);
		solve(ry, vy, y1, y2);
	}

	//printf("%lf %lf\n", L, R);
	if (L - eps > R) cant();
	printf("%lf\n", L);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int INF = 1e9 + 10;
const double eps = 1e-8;

int N;
int x1, y1, x2, y2;

void cant() {
	printf("-1\n");
	exit(0);
}

double L = 0, R = INF;

void solve(int x, int v, int l, int r) {
	if (v == 0) {
		if (x <= l || x >= r) cant();
		return;
	}

	double t1 = double(l-x)/double(v);
	double t2 = double(r-x)/double(v);
	if (t1 > t2) swap(t1, t2);

	L = max(L, t1);
	R = min(R, t2);
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d", &N);
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

	for (int i = 1; i <= N; i++) {
		int rx, ry, vx, vy;
		scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
		solve(rx, vx, x1, x2);
		solve(ry, vy, y1, y2);
	}

	if (L + eps > R) cant();
	printf("%lf\n", L);

	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = inf;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x >= t1.x && p.x <= t2.x) {
			mn = 1;
			mx = -1;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y >= t1.y && p.y <= t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn <= mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = 1 << 30;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && (p.x <= t1.x || p.x >= t2.x)) {
			mn = mx = 0;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && (p.y <= t1.y || p.y >= t2.y)) {
			mn = mx = 0;
		}
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn < mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = 1 << 30;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && (p.x < t1.x || p.x > t2.x)) {
			mn = mx = 0;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && (p.y < t1.y || p.y > t2.y)) {
			mn = mx = 0;
		}
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn < mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = -inf;
	double mx = inf;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x >= t1.x && p.x <= t2.x) {
			mn = 1;
			mx = -1;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y >= t1.y && p.y <= t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn <= mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = inf;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x > t1.x && p.x < t2.x) {
			mn = 1;
			mx = -1;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y > t1.y && p.y < t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn <= mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = 1 << 30;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x > t1.x && p.x < t2.x) {
			mn = 1;
			mx = -1;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y > t1.y && p.y < t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn <= mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = 1 << 30;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && (p.x <= t1.x || p.x >= t2.x)) {
			mn = mx = 0;
		} else {
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);
		}
		if (vl.y == 0 && (p.y <= t1.y || p.y >= t2.y)) {
			mn = mx = 0;
		} else {
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
		}
	}

	if (mn < mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = 0;
	double mx = 1 << 30;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x > t1.x && p.x < t2.x) {
			mn = 1;
			mx = -1;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y > t1.y && p.y < t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn < mx)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = -inf;
	double mx = inf;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x >= t1.x && p.x <= t2.x) {
			mn = 1;
			mx = -1;
		}
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y >= t1.y && p.y <= t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn <= mx && mn >= 0)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

int n;

struct pos
{
	int x, y;

	pos(){}
	pos(int x, int y) : x(x), y(y) {}
};

pos t1;
pos t2;

const int maxn = 100000;
const int inf = 999999;
pos r[maxn];
pos v[maxn];

int main()
{
	cin >> n;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;

	if (t1.x > t2.x)
		swap(t1, t2);
	if (t1.y > t2.y)
		swap(t1.y, t2.y);

	for (int i = 0; i < n; i++) {
		cin >> r[i].x >> r[i].y >> v[i].x >> v[i].y;
	}

	double mn = -inf;
	double mx = inf;
	for (int i = 0; i < n; i++) {
		pos p = r[i];
		pos vl = v[i];

		if (vl.x == 0 && p.x >= t1.x && p.x <= t2.x)
			mn = mx = 0;
		double aX1 = (t1.x - p.x) / (double) vl.x;
		double aX2 = (t2.x - p.x) / (double) vl.x;
		mn = max( min(aX1, aX2), mn);
		mx = min( max(aX1, aX2), mx);

		if (vl.y == 0 && p.y >= t1.y && p.y <= t2.y)
			mn = mx = 0;
		double aY1 = (t1.y - p.y) / (double) vl.y;
		double aY2 = (t2.y - p.y) / (double) vl.y;
		mn = max( min(aY1, aY2), mn);
		mx = min( max(aY1, aY2), mx);
	}

	if (mn <= mx && mx != 0)
		cout << mn << endl;
	else
		cout << -1 << endl;
	return 0;
}


#include <bits/stdc++.h>
#define ff(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)
#define fb(i, a, b) for(int i = (a), _b = (b); i >= _b; i--)
#define pb push_back
#define y1 fmdkmaewof

typedef long long ll;
using namespace std;
typedef vector <int> vi;

const double eps = 1e-9;
int N;
int x1, y1, x2, y2;
int rx, ry, vx, vy;
pair <int, int> Min, Max;

bool cmp(pair <int, int> a, pair <int, int> b) { return 1ll * a.first * b.second < 1ll * a.second * b.first; }

void work(int l, int r, int v) {
    if (v == 0) {
        if (l >= 0 || r <= 0) {
            cout << -1 << endl;
            exit(0);
        }
        return;
    }
    if (v < 0) l = -l, r = -r, v = -v, swap(l, r);
    pair <int, int> L = make_pair(l, v), R = make_pair(r, v);
    if (Min == make_pair(0, 0) || cmp(Min, L)) Min = L;
    if (Max == make_pair(0, 0) || cmp(R, Max)) Max = R;
}

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    cin >> x1 >> y1 >> x2 >> y2;
    Min = make_pair(0, 1);
    ff(i, 1, N) {
        cin >> rx >> ry >> vx >> vy;
        work(x1 - rx, x2 - rx, vx);
        work(y1 - ry, y2 - ry, vy);
    }
    if (!cmp(Min, Max)) return cout << -1 << endl, 0;
    cout << setprecision(15) << fixed << ((double)Min.first / Min.second + eps) << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ff(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)
#define fb(i, a, b) for(int i = (a), _b = (b); i >= _b; i--)
#define pb push_back
#define y1 fmdkmaewof

typedef long long ll;
using namespace std;
typedef vector <int> vi;

const double eps = 1e-9;
int N;
int x1, y1, x2, y2;
int rx, ry, vx, vy;
pair <int, int> Min, Max;

bool cmp(pair <int, int> a, pair <int, int> b) { return 1ll * a.first * b.second < 1ll * a.second * b.first; }

void work(int l, int r, int v) {
    if (v == 0) {
        if (l >= 0 || r <= 0) {
            cout << -1 << endl;
            exit(0);
        }
        return;
    }
    if (v < 0) l = -l, r = -r, v = -v, swap(l, r);
    pair <int, int> L = make_pair(l, v), R = make_pair(r, v);
    if (cmp(Min, L)) Min = L;
    if (cmp(R, Max)) Max = R;
}

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    cin >> x1 >> y1 >> x2 >> y2;
    Min = make_pair(0, 1);
    Max = make_pair(1, 0);
    ff(i, 1, N) {
        cin >> rx >> ry >> vx >> vy;
        work(x1 - rx, x2 - rx, vx);
        work(y1 - ry, y2 - ry, vy);
    }
    if (!cmp(Min, Max)) return cout << -1 << endl, 0;
    cout << setprecision(15) << fixed << ((double)Min.first / Min.second + eps) << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ff(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)
#define fb(i, a, b) for(int i = (a), _b = (b); i >= _b; i--)
#define pb push_back
#define y1 fmdkmaewof

typedef long long ll;
using namespace std;
typedef vector <int> vi;

int N;
int x1, y1, x2, y2;
int rx, ry, vx, vy;
pair <int, int> Min, Max;

bool cmp(pair <int, int> a, pair <int, int> b) { return 1ll * a.first * b.second < 1ll * a.second * b.first; }

void work(int l, int r, int v) {
    if (v == 0) {
        if (l > 0 || r < 0) {
            cout << -1 << endl;
            exit(0);
        }
        return;
    }
    if (v < 0) l = -l, r = -r, v = -v, swap(l, r);
    pair <int, int> L = make_pair(l, v), R = make_pair(r, v);
    if (Min == make_pair(0, 0) || cmp(Min, L)) Min = L;
    if (Max == make_pair(0, 0) || cmp(R, Max)) Max = R;
}

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    cin >> x1 >> y1 >> x2 >> y2;
    Min = make_pair(0, 1);
    ff(i, 1, N) {
        cin >> rx >> ry >> vx >> vy;
        work(x1 - rx, x2 - rx, vx);
        work(y1 - ry, y2 - ry, vy);
    }
    if (cmp(Max, Min)) return cout << -1 << endl, 0;
    cout << setprecision(15) << fixed << (double)Min.first / Min.second << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-12;

int n;
double ans = 0;
int x1;
int y1;
int x2, y2;
int rx[MAXN], ry[MAXN], vx[MAXN], vy[MAXN];

int pd(double ans)
{
    for(int i = 0; i < n; i++)
    {
        double xx, yy;
        xx = 1.0*rx[i] + vx[i]*ans;
        yy = 1.0*ry[i] + vy[i]*ans;
        if(vx[i] > 0)
        {
            if(rx[i]>x2)
                return 4;
            if(xx < x1)
                return 2;
            else if(xx > x2)
                return 3;
        }
        else if(vx[i] < 0)
        {
            if(rx[i] < x1)
                return 4;
            if(xx > x2)
                return 2;
            else if(xx < x1)
                return 3;
        }
        else if(vx[i] == 0)
        {
            if(xx >= x2 || xx <= x1)
                return 4;
        }
        else if(vy[i] > 0)
        {
            if(ry[i] > y2)
                return 4;
            if(yy < y1)
                return 2;
            else if(yy > y2)
                return 3;
        }
        else if(vy[i] < 0)
        {
            if(ry[i] < y1)
                return 4;
            if(yy > y2)
                return 2;
            else if(yy < y1)
                return 3;
        }
        else if(vy[i] == 0)
        {
            if(yy >= y2 || yy <= y1)
                return 4;
        }
    }
    return 1;
}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        cin >> rx[i] >> ry[i] >> vx[i] >> vy[i];
    }
    double r = 0, l = 1e9;
    while(l-r > eps)
    {
        double mid = (r+l)/2;
        if(pd(mid) == 1)
            l = mid, ans = mid;
        else if(pd(mid) == 2)
            r = mid;
        else if(pd(mid) == 3)
            l = mid;
        else
            break;
    }
    if(pd(ans) == 1)
        cout << ans << endl;
    else
        cout << "-1" << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-12;

int n;
double ans = 0;
int x1;
int y1;
int x2, y2;
int rx[MAXN], ry[MAXN], vx[MAXN], vy[MAXN];

int pd(double ans)
{
    for(int i = 0; i < n; i++)
    {
        double xx, yy;
        xx = 1.0*rx[i] + vx[i]*ans;
        yy = 1.0*ry[i] + vy[i]*ans;
        if(vx[i] > 0)
        {
            if(rx[i] > x2)
                return 4;
            if(xx < x1)
                return 2;
            if(xx > x2)
                return 3;
        }
        if(vx[i] < 0)
        {
            if(rx[i] < x1)
                return 4;
            if(xx > x2)
                return 2;
            if(xx < x1)
                return 3;
        }
        if(vx[i] == 0)
        {
            if(xx >= x2 || xx <= x1)
                return 4;
        }
        if(vy[i] > 0)
        {
            if(ry[i] > y2)
                return 4;
            if(yy < y1)
                return 2;
            if(yy > y2)
                return 3;
        }
        if(vy[i] < 0)
        {
            if(ry[i] < y1)
                return 4;
            if(yy > y2)
                return 2;
            if(yy < y1)
                return 3;
        }
        if(vy[i] == 0)
        {
            if(yy >= y2 || yy <= y1)
                return 4;
        }
    }
    return 1;
}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        cin >> rx[i] >> ry[i] >> vx[i] >> vy[i];
    }
    double r = 0, l = 1e9;
    while(l-r > eps)
    {
        double mid = (r+l)/2;
        if(pd(mid) == 1)
            l = mid, ans = mid;
        else if(pd(mid) == 2)
            r = mid;
        else if(pd(mid) == 3)
            l = mid;
        else
            break;
    }
    if(pd(ans) == 1)
        cout << ans << endl;
    else
        cout << "-1" << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-12;

int n;
double ans = 0;
double x1;
double y1;
double x2, y2;
double rx[MAXN], ry[MAXN], vx[MAXN], vy[MAXN];

int pd(double ans)
{
    for(int i = 0; i < n; i++)
    {
        double xx, yy;
        xx = rx[i] + vx[i]*ans;
        yy = ry[i] + vy[i]*ans;
        if(vx[i] > 0)
        {
            if(xx < x1)
                return 2;
            if(xx > x2)
                return 3;
        }
        if(vx[i] < 0)
        {
            if(xx > x2)
                return 2;
            if(xx < x1)
                return 3;
        }
        if(vx[i] == 0)
        {
            if(xx > x2 || xx < x1)
                return 4;
        }
        if(vy[i] > 0)
        {
            if(yy < y1)
                return 2;
            if(yy > y2)
                return 3;
        }
        if(vy[i] < 0)
        {
            if(yy > y2)
                return 2;
            if(yy < y1)
                return 3;
        }
        if(vy[i] == 0)
        {
            if(yy > y2 || yy < y1)
                return 4;
        }
    }
    return 1;
}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        scanf("%lf %lf %lf %lf", &rx[i], &ry[i], &vx[i], &vy[i]);
    }
    double r = 0, l = 1e12;
    while(l-r > eps)
    {
        double mid = (r+l)/2;
        if(pd(mid) == 1)
            l = mid, ans = mid;
        else if(pd(mid) == 2)
            r = mid;
        else if(pd(mid) == 3)
            l = mid;
        else
            break;
    }
    if(pd(ans) == 1)
        printf("%.12f\n", ans);
    else
        cout << "-1" << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-12;

int n;
double ans = 0;
int x1;
int y1;
int x2, y2;
int rx, ry, vx, vy;
double l = 0, r = 1e9;

void solve(int zb, int sd, int zb1, int zb2)
{
    double ll, rr;
    if(sd < 0)
    {
        ll = (zb-zb2)*1.0/(-1.0*sd);
        rr = (zb-zb1)*1.0/(-1.0*sd);
        l = max(l, ll);
        r = min(r, rr);
    }
    else if(sd > 0)
    {
        rr = (zb-zb2)*1.0/(-1.0*sd);
        ll = (zb-zb1)*1.0/(-1.0*sd);
        l = max(l, ll);
        r = min(r, rr);
    }
    else
    {
        if(zb > zb2 || zb < zb1)
        {
            l = 1e9;
            r = 0;
        }
    }

}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        cin >> rx >> ry >> vx >> vy;
        solve(rx, vx, x1, x2);
        solve(ry, vy, y1, y2);
    }
    //cout << l << " " << r << endl;
    if(l < r)
        cout << l << endl;
    else
        cout << "-1" << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-12;

int n;
double ans = 0;
int x1;
int y1;
int x2, y2;
int rx, ry, vx, vy;
double l = 0, r = 1e9;

void solve(int zb, int sd, int zb1, int zb2)
{
    double ll, rr;
    if(sd < 0)
    {
        ll = (zb-zb2)*1.0/(-1.0*sd);
        rr = (zb-zb1)*1.0/(-1.0*sd);
        l = max(l, ll);
        r = min(r, rr);
    }
    else if(sd > 0)
    {
        rr = (zb-zb2)*1.0/(-1.0*sd);
        ll = (zb-zb1)*1.0/(-1.0*sd);
        l = max(l, ll);
        r = min(r, rr);
    }
    else
    {
        if(zb >= zb2 || zb <= zb1)
        {
            l = 1e9;
            r = 0;
        }
    }

}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        cin >> rx >> ry >> vx >> vy;
        solve(rx, vx, x1, x2);
        solve(ry, vy, y1, y2);
    }
    //cout << l << " " << r << endl;
    if(l < r)
        cout << l << endl;
    else
        cout << "-1" << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-9;

int n;
double ans = 0;
double x1;
double y1;
double x2, y2;
double rx[MAXN], ry[MAXN], vx[MAXN], vy[MAXN];

int pd(double ans)
{
    for(int i = 0; i < n; i++)
    {
        double xx, yy;
        xx = rx[i] + vx[i]*ans;
        yy = ry[i] + vy[i]*ans;
        if(vx[i] > 0)
        {
            if(xx < x1)
                return 2;
            if(xx > x2)
                return 3;
        }
        if(vx[i] < 0)
        {
            if(xx > x2)
                return 2;
            if(xx < x1)
                return 3;
        }
        if(vx[i] == 0)
        {
            if(xx > x2 && xx < x1)
                return 4;
        }
        if(vy[i] > 0)
        {
            if(yy < y1)
                return 2;
            if(yy > y2)
                return 3;
        }
        if(vy[i] < 0)
        {
            if(yy > y2)
                return 2;
            if(yy < y1)
                return 3;
        }
        if(vy[i] == 0)
        {
            if(yy > y2 && yy < y1)
                return 4;
        }
    }
    return 1;
}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        scanf("%lf %lf %lf %lf", &rx[i], &ry[i], &vx[i], &vy[i]);
    }
    double r = 0, l = 1e12;
    while(l-r > eps)
    {
        double mid = (r+l)/2;
        //cout << pd(mid) << endl;
        if(pd(mid) == 1)
            l = mid, ans = mid;
        else if(pd(mid) == 2)
            r = mid;
        else if(pd(mid) == 3)
            l = mid;
        else
            break;
        //cout << "ans:" << endl;
    }
    if(pd(ans) == 1)
        cout << ans << endl;
    else
        cout << "-1" << endl;
    return 0;
}


#include<iostream>
#include <stdio.h>
using namespace std;
const int MAXN = 1e5+5;
const double eps = 1e-12;

int n;
double ans = 0;
int x1;
int y1;
int x2, y2;
int rx[MAXN], ry[MAXN], vx[MAXN], vy[MAXN];

int pd(double ans)
{
    for(int i = 0; i < n; i++)
    {
        double xx, yy;
        xx = 1.0*rx[i] + vx[i]*ans;
        yy = 1.0*ry[i] + vy[i]*ans;
        if(vx[i] > 0)
        {
            if(xx < x1)
                return 2;
            if(xx > x2)
                return 3;
        }
        if(vx[i] < 0)
        {
            if(xx > x2)
                return 2;
            if(xx < x1)
                return 3;
        }
        if(vx[i] == 0)
        {
            if(xx >= x2 || xx <= x1)
                return 4;
        }
        if(vy[i] > 0)
        {
            if(yy < y1)
                return 2;
            if(yy > y2)
                return 3;
        }
        if(vy[i] < 0)
        {
            if(yy > y2)
                return 2;
            if(yy < y1)
                return 3;
        }
        if(vy[i] == 0)
        {
            if(yy >= y2 || yy <= y1)
                return 4;
        }
    }
    return 1;
}

int main()
{
    cin >> n;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0; i < n; i++)
    {
        cin >> rx[i] >> ry[i] >> vx[i] >> vy[i];
    }
    double r = 0, l = 1e9;
    while(l-r > eps)
    {
        double mid = (r+l)/2;
        if(pd(mid) == 1)
            l = mid, ans = mid;
        else if(pd(mid) == 2)
            r = mid;
        else if(pd(mid) == 3)
            l = mid;
        else
            break;
    }
    if(pd(ans) == 1)
        cout << ans << endl;
    else
        cout << "-1" << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) //cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

double eps = 1e-6;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    double x1, y1, x2, y2;
    //scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    cin >> x1 >> y1 >> x2 >> y2;
    bool corr = true;
    if (x1==x2 and y1 == y2) corr = false;
    x1 += eps;
    x2 -= eps;
    y1 += eps;
    y2 -= eps;
    interval res = interval((double) (-INF), (double) (INF));
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;

        //cout << "X:" << t1x << "/" <<t2x << endl;
        interval ix;
        t1x = max(t1x, 0.0);
        t2x = max(t2x, 0.0);
        ix = interval(min(t1x, t2x), max(t1x, t2x));
        //cout << "X Calc:" << ix.first << "/" << ix.second << endl;

        //cout << "Y:" << t1y << "/" <<t2y << endl;
        interval iy;
        t1y = max(t1y, 0.0);
        t2y = max(t2y, 0.0);
        iy = interval(min(t1y, t2y), max(t1y, t2y));
        //cout << "Y Calc:" << iy.first << "/" << iy.second << endl;

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        //printf("Result:\n");
        //cout << res.first << '/' << res.second << endl << endl;
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    interval res = interval((double) (-INF), (double) (INF));
    bool corr = true;
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        if (t1x < 0 or t2x < 0 or t1y < 0 or t2y < 0) corr = false;
        //cout << "X:" << t1x << "/" <<t2x << endl;
        //cout << "Y:" << t1y << "/" <<t2y << endl;
        interval ix = interval(t1x, t2x);
        interval iy = interval(t1y, t2y);
        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) //cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

double eps = 1e-6;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    x1 += eps;
    x2 -= eps;
    y1 += eps;
    y2 -= eps;
    interval res = interval((double) (-INF), (double) (INF));
    bool corr = true;
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        //D((max(t1x, t2x)<0 || max(t1y, t2y)<0));
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;

        //cout << "X:" << t1x << "/" <<t2x << endl;
        interval ix;
        t1x = max(t1x, 0.0);
        t2x = max(t2x, 0.0);
        ix = interval(min(t1x, t2x), max(t1x, t2x));
        //cout << "X Calc:" << ix.first << "/" << ix.second << endl;

        //cout << "Y:" << t1y << "/" <<t2y << endl;
        interval iy;
        t1y = max(t1y, 0.0);
        t2y = max(t2y, 0.0);
        iy = interval(min(t1y, t2y), max(t1y, t2y));
        //cout << "Y Calc:" << iy.first << "/" << iy.second << endl;

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        //printf("Result:\n");
        //cout << res.first << '/' << res.second << endl << endl;
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    interval res = interval((double) (-INF), (double) (INF));
    bool corr = true;
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        //D((max(t1x, t2x)<0 || max(t1y, t2y)<0));
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;
        //cout << "X:" << t1x << "/" <<t2x << endl;
        //cout << "Y:" << t1y << "/" <<t2y << endl;

        interval ix;
        if ((t1x == 0 and t2x >0) || (t2x == 0 and t1x >0)) ix = interval(min(t1x, t2x), max(t1x, t2x));
        else ix = interval(t1x, t2x);
        interval iy;
        if ((t1y == 0 and t2y >0) || (t2y == 0 and t1y >0)) iy = interval(min(t1y, t2y), max(t1y, t2y));
        else iy = interval(t1y, t2y);

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) //cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

double eps = 1e-6;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    double x1, y1, x2, y2;
    //scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    cin >> x1 >> y1 >> x2 >> y2;
    bool corr = true;
    if (x1==x2 or y1 == y2) corr = false;
    x1 += eps;
    x2 -= eps;
    y1 += eps;
    y2 -= eps;
    interval res = interval((double) (-INF), (double) (INF));
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;

        //cout << "X:" << t1x << "/" <<t2x << endl;
        interval ix;
        t1x = max(t1x, 0.0);
        t2x = max(t2x, 0.0);
        ix = interval(min(t1x, t2x), max(t1x, t2x));
        //cout << "X Calc:" << ix.first << "/" << ix.second << endl;

        //cout << "Y:" << t1y << "/" <<t2y << endl;
        interval iy;
        t1y = max(t1y, 0.0);
        t2y = max(t2y, 0.0);
        iy = interval(min(t1y, t2y), max(t1y, t2y));
        //cout << "Y Calc:" << iy.first << "/" << iy.second << endl;

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        //printf("Result:\n");
        //cout << res.first << '/' << res.second << endl << endl;
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    interval res = interval((double) (-INF), (double) (INF));
    bool corr = true;
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        //D((max(t1x, t2x)<0 || max(t1y, t2y)<0));
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;
        //cout << "X:" << t1x << "/" <<t2x << endl;
        //cout << "Y:" << t1y << "/" <<t2y << endl;

        interval ix;
        if ((t1x == 0 and t2x >0) or (t2x == 0 and t1x >0)) ix = interval(min(t1x, t2x), max(t1x, t2x));
        else interval(t1x, t2x);
        interval iy;
        if ((t1y == 0 and t2y >0) or (t2y == 0 and t1y >0)) iy = interval(min(t1y, t2y), max(t1y, t2y));
        else interval(t1y, t2y);

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    interval res = interval((double) (-INF), (double) (INF));
    bool corr = true;
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        //D((max(t1x, t2x)<0 || max(t1y, t2y)<0));
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;
        //cout << "X:" << t1x << "/" <<t2x << endl;
        //cout << "Y:" << t1y << "/" <<t2y << endl;

        interval ix;
        if ((t1x == 0 and t2x >0) || (t2x == 0 and t1x >0)) ix = interval(min(t1x, t2x), max(t1x, t2x));
        else if ((t1x == 0) || (t2x == 0)) ix = interval(0.0,0.0);
        else ix = interval(min(max(0.0, t1x), t2x), max(max(t2x, 0.0), t1x));
        interval iy;
        if ((t1y == 0 and t2y >0) || (t2y == 0 and t1y >0)) iy = interval(min(t1y, t2y), max(t1y, t2y));
        else if ((t1y == 0) || (t2y == 0)) iy = interval(0.0,0.0);
        else iy = interval(min(max(0.0, t1y), t2y), max(max(t2y, 0.0), t1y));

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) //cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

double eps = 1e-6;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    double x1, y1, x2, y2;
    //scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    cin >> x1 >> y1 >> x2 >> y2;
    x1 += eps;
    x2 -= eps;
    y1 += eps;
    y2 -= eps;
    interval res = interval((double) (-INF), (double) (INF));
    bool corr = true;
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;

        //cout << "X:" << t1x << "/" <<t2x << endl;
        interval ix;
        t1x = max(t1x, 0.0);
        t2x = max(t2x, 0.0);
        ix = interval(min(t1x, t2x), max(t1x, t2x));
        //cout << "X Calc:" << ix.first << "/" << ix.second << endl;

        //cout << "Y:" << t1y << "/" <<t2y << endl;
        interval iy;
        t1y = max(t1y, 0.0);
        t2y = max(t2y, 0.0);
        iy = interval(min(t1y, t2y), max(t1y, t2y));
        //cout << "Y Calc:" << iy.first << "/" << iy.second << endl;

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        //printf("Result:\n");
        //cout << res.first << '/' << res.second << endl << endl;
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define D(_x) //cout << #_x":" << _x << endl;
#define INF 1152921504606846976

typedef pair<double, double> interval;

double eps = 1e-6;

interval intersect(interval a, interval b){
    return interval(max(a.first, b.first), min(a.second, b.second));
}

int main(){
    int N; scanf("%d", &N);
    double x1, y1, x2, y2;
    //scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    cin >> x1 >> y1 >> x2 >> y2;
    bool corr = true;
    if (x1==x2 and y1 == y2) corr = false;
    x1 += eps;
    x2 -= eps;
    y1 += eps;
    y2 -= eps;
    interval res = interval((double) (-INF), (double) (INF));
    while (N-- and corr){
        int rx, ry, vx, vy;
        scanf("%d %d %d %d", &rx, &ry, &vx, &vy);
        double t1x = (double)(x1 - rx) / (double) vx;
        double t2x = (double)(x2 - rx) / (double) vx;
        double t1y = (double)(y1 - ry) / (double) vy;
        double t2y = (double)(y2 - ry) / (double) vy;
        if (max(t1x, t2x)<0 || max(t1y, t2y)<0) corr = false;

        cout << "X:" << t1x << "/" <<t2x << endl;
        interval ix;
        t1x = max(t1x, 0.0);
        t2x = max(t2x, 0.0);
        ix = interval(min(t1x, t2x), max(t1x, t2x));
        cout << "X Calc:" << ix.first << "/" << ix.second << endl;

        cout << "Y:" << t1y << "/" <<t2y << endl;
        interval iy;
        t1y = max(t1y, 0.0);
        t2y = max(t2y, 0.0);
        iy = interval(min(t1y, t2y), max(t1y, t2y));
        cout << "Y Calc:" << iy.first << "/" << iy.second << endl;

        interval cur = intersect(ix, iy);
        res = intersect(cur, res);
        //printf("Result:\n");
        cout << res.first << '/' << res.second << endl << endl;
        if (res.first > res.second) corr = false;
    }
    cout.precision(8);
    if (corr) cout << res.first;
    else cout << -1;
}


/*
ID: justinz3
PROG: __
LANG: C++
*/
#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

struct point
{
	int x, y;
};

struct mouse
{
	struct point start;
	int x, y;
};

int n;
vector <struct mouse> mice;
int maxx, maxy, minx, miny; // rect

double time1, time2;
double one = 1;

void intersect(int index)
{
	struct mouse in = mice[index];

	time1 = -1;
	time2 = -1;

	if(in.y == 0 and (in.start.y == maxy or in.start.y == miny))
	{
		return;
	}
	if(in.x == 0 and (in.start.x == maxx or in.start.x == minx))
	{
		return;
	}

	double time;

	if(in.x != 0)
	{
		time = (one * minx - in.start.x) / in.x; // left side

		if(time >= 0 and miny <= in.start.y + in.y * time and in.start.y + in.y * time <= maxy)
		{
			//cout << "left " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}
		time = (one * maxx - in.start.x) / in.x; // right side

		if(time >= 0 and miny <= in.start.y + in.y * time and in.start.y + in.y * time <= maxy)
		{
			//cout << "right " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}
	}

	if(in.y != 0)
	{
		time = (one * miny - in.start.y) / in.y; // bottom

		if(time >= 0 and minx <= in.start.x + in.x * time and in.start.x + in.x * time <= maxx)
		{
			//cout << "bottom " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}

		time = (one * maxy - in.start.y) / in.y; // top

		if(time >= 0 and minx <= in.start.x + in.x * time and in.start.x + in.x * time <= maxx)
		{
			//cout << "top " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}
	}

	//cout << endl;
	double temp = time2;
	if(time1 > time2)
	{
		time2 = time1;
		time1 = temp;
	}
}

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");
	cin >> n;
	cin >> minx >> miny >> maxx >> maxy;

	struct mouse in;

	double early = 0, late = 1000100;
	for(int i = 0; i < n; i++)
	{
		cin >> in.start.x >> in.start.y >> in.x >> in.y;
		mice.push_back(in);

		intersect(i);
		//cout << time1 << " " << time2 << endl << endl;
		if(time1 == -1 or time2 == -1)
		{
			cout << -1 << endl;
			return 0;
		}

		early = max(early, time1);
		late = min(late, time2);
	}

	if(late < early) // shouldn't happen
	{
		//cout << -2 << endl;
		return 0;
	}

	cout << fixed << setprecision(20) << early << endl;
}


/*
ID: justinz3
PROG: __
LANG: C++
*/
#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

struct point
{
	int x, y;
};

struct mouse
{
	struct point start;
	int x, y;
};

int n;
vector <struct mouse> mice;
int maxx, maxy, minx, miny; // rect

double time1, time2;
double one = 1;

void intersect(int index)
{
	struct mouse in = mice[index];

	time1 = -1;
	time2 = -1;

	double time;

	time = (one * minx - in.start.x) / in.x; // left side

	if(time >= 0 and miny <= in.start.y + in.y * time and in.start.y + in.y * time <= maxy)
	{
		//cout << "left " << time << endl;
		if(time1 >= 0 and time != time1)
			time2 = time;
		else
			time1 = time;
	}

	time = (one * maxx - in.start.x) / in.x; // right side

	if(time >= 0 and miny <= in.start.y + in.y * time and in.start.y + in.y * time <= maxy)
	{
		//cout << "right " << time << endl;
		if(time1 >= 0 and time != time1)
			time2 = time;
		else
			time1 = time;
	}

	time = (one * miny - in.start.y) / in.y; // bottom

	if(time >= 0 and minx <= in.start.x + in.x * time and in.start.x + in.x * time <= maxx)
	{
		//cout << "bottom " << time << endl;
		if(time1 >= 0 and time != time1)
			time2 = time;
		else
			time1 = time;
	}

	time = (one * maxy - in.start.y) / in.y; // top

	if(time >= 0 and minx <= in.start.x + in.x * time and in.start.x + in.x * time <= maxx)
	{
		//cout << "top " << time << endl;
		if(time1 >= 0 and time != time1)
			time2 = time;
		else
			time1 = time;
	}

	//cout << endl;
	double temp = time2;
	if(time1 > time2)
	{
		time2 = time1;
		time1 = temp;
	}
}

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");
	cin >> n;
	cin >> minx >> miny >> maxx >> maxy;

	struct mouse in;

	double early = 0, late = 1000100;
	for(int i = 0; i < n; i++)
	{
		cin >> in.start.x >> in.start.y >> in.x >> in.y;
		mice.push_back(in);

		intersect(i);
		//cout << time1 << " " << time2 << endl << endl;
		if(time1 == -1 or time2 == -1)
		{
			cout << -1 << endl;
			return 0;
		}

		early = max(early, time1);
		late = min(late, time2);
	}

	if(late < early) // shouldn't happen
	{
		cout << -2 << endl;
		return 0;
	}

	cout << fixed << setprecision(20) << early << endl;
}


/*
ID: justinz3
PROG: __
LANG: C++
*/
#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

struct point
{
	int x, y;
};

struct mouse
{
	struct point start;
	int x, y;
};

int n;
vector <struct mouse> mice;
int maxx, maxy, minx, miny; // rect

double time1, time2;
double one = 1;

void intersect(int index)
{
	struct mouse in = mice[index];

	time1 = -1;
	time2 = -1;

	//cout << time1 << " " << time2 << endl;

	if(in.y == 0 and (in.start.y == maxy or in.start.y == miny))
	{
		return;
	}
	if(in.x == 0 and (in.start.x == maxx or in.start.x == minx))
	{
		return;
	}

	double time;

	if(in.x != 0)
	{
		time = (one * minx - in.start.x) / in.x; // left side

		if(time >= 0 and miny <= in.start.y + in.y * time and in.start.y + in.y * time <= maxy)
		{
			//cout << "left " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}
		time = (one * maxx - in.start.x) / in.x; // right side

		if(time >= 0 and miny <= in.start.y + in.y * time and in.start.y + in.y * time <= maxy)
		{
			//cout << "right " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}
	}

	//cout << time1 << " " << time2 << endl;

	if(in.y != 0)
	{
		time = (one * miny - in.start.y) / in.y; // bottom

		if(time >= 0 and minx <= in.start.x + in.x * time and in.start.x + in.x * time <= maxx)
		{
			//cout << "bottom " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}

		time = (one * maxy - in.start.y) / in.y; // top

		if(time >= 0 and minx <= in.start.x + in.x * time and in.start.x + in.x * time <= maxx)
		{
			//cout << "top " << time << endl;
			if(time1 >= 0 and time != time1)
				time2 = time;
			else
				time1 = time;
		}
	}

	//cout << endl;
	double temp = time2;
	if(time1 > time2 and time2 != -1)
	{
		time2 = time1;
		time1 = temp;
	}
}

bool inside_rect(struct mouse in)
{

	return (minx < in.start.x and in.start.x < maxx) and (miny < in.start.y and in.start.y < maxy);
	// this means that mouse will be moving and therefore moves into rect
}

bool on_edge(int index)
{
	struct mouse in = mice[index];

	return ((minx < in.start.x and in.start.x < maxx) and (in.start.y == miny or in.start.y == maxy)) or
	       ((miny < in.start.y and in.start.y < maxy) and (in.start.x == minx or in.start.x == maxx));
}

bool heading_in(int index)
{
	struct mouse in = mice[index];

	in.start.x += 0.00000000000000001 * in.x;
	in.start.y += 0.00000000000000001 * in.y;

	return inside_rect(in);
}

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");
	cin >> n;
	cin >> minx >> miny >> maxx >> maxy;

	struct mouse in;

	double early = 0, late = 1000100;
	for(int i = 0; i < n; i++)
	{
		cin >> in.start.x >> in.start.y >> in.x >> in.y;
		mice.push_back(in);

		intersect(i);
		//cout << inside_rect(mice[i]) << endl;
		//cout << time1 << " " << time2 << endl << endl;
		if((time1 == -1 or time2 == -1) and not(inside_rect(mice[i])))
		{
			cout << -1 << endl;
			return 0;
		}

		if(not(inside_rect(mice[i])) and not(on_edge(i) and heading_in(i)))
			early = max(early, time1);
		late = min(late, time2);
	}

	//cout << early << " " << late << endl;

	if(late < early and late != -1)
	{
		cout << -1 << endl;
		return 0;
		//early = late;
	}

	cout << fixed << setprecision(20) << early << endl;
}