//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0));
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long long int s = 0;
	for(int i = 0; i < n; i++)
		s += a[i];
	if(s > p)
		return cout << "-1\n", 0;
	long double l = 0, r = 1e11, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e10 + 20)
		cout << "-1\n";
	else
		cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0)) / p;
	}
	if(chTime - EPS < mid)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e16, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e15)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0)) / p;
	}
	if(chTime - EPS < mid)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e10, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e9)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += max(a[i] * mid - b[i], (long double)0.0);
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e16, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e16 - 2)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0)) / p;
	}
	if(chTime - EPS < mid)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e15, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e14)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0));
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e11, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e10)
		cout << "-1\n";
	else
		cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0));
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e11, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e10 + 20)
		cout << "-1\n";
	else
		cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0));
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e10, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e9)
		cout << "-1\n";
	else
		cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += max(a[i] * mid - b[i], (long double)0.0);
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e20, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e19)
		cout << "-1\n";
	else
		cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(double mid, int n, int p){
	double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += max(a[i] * mid - b[i], 0.0);
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e16, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e16 - 2)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0))/ p;
	}
	if(chTime - EPS < mid)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long double l = 0, r = 1e16, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 1e16 - 2)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(double mid, int n, int p){
	double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += max(a[i] * mid - b[i], 0.0);
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	double l = 0, r = 2e5 + 20, ans = 0;
	for(int i = 0; i < 40; i++){
		double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	if(ans > 2e5 + 1)
		cout << "-1\n";
	else
		cout << setprecision(10) << ans << '\n';
	return 0;
}


//============================================================================
// Name        : firstTrial.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
#define EPS 1e-9
int a[N], b[N];
bool check(long double mid, int n, int p){
	long double chTime = 0;
	for(int i = 0; i < n; i++){
		chTime += (max(a[i] * mid - b[i], (long double)0.0));
	}
	if(chTime - EPS < mid * p)
		return 1;
	return 0;
}
int main(){
// 	setvbuf(stdout, NULL, _IONBF, 0);
	int n, p;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	long long int s = 0;
	for(int i = 0; i < n; i++)
		s += a[i];
	if(s <= p)
		return cout << "-1\n", 0;
	long double l = 0, r = 1e11, ans = 0;
	for(int i = 0; i < 200; i++){
		long double mid = (l + r) / 2;
		if(check(mid, n, p))
			ans = mid, l = mid;
		else
			r = mid;

	}
	cout << fixed << setprecision(10) << ans << '\n';
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<iostream>
#include<queue>
#include<stack>
#include<cassert>
#include<set>
#include<map>
#define y1 dnjsfndkls
#define pb push_back
#define fir first
#define sec second
#define tm suifhsduifhais
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const double PI=acos(-1.0);
template<class T>
void Read(T &x){
    char c;
    bool f=0;
    while(c=getchar(),c!=EOF)
        if(c=='-') f=1;
        else if(c>='0'&&c<='9'){
            x=c-'0';
            while(c=getchar(),c>='0'&&c<='9')
                x=x*10+c-'0';
            ungetc(c,stdin);
            if(f) x=-x;
            return ;
        }
}
//***************************************

#define INF 1e12
#define eps 1e-8
#define MAXN 100000
#define lmt 70

int n,p;
pii a[MAXN+10];

int dcmp(double x){
	return fabs(x)<eps?0:(x<0?-1:1);
}
void read(){
	Read(n),Read(p);
	for(int i=1;i<=n;i++)
		Read(a[i].fir),Read(a[i].sec);
}
bool check(double mid){
	double t,tot=0;
	for(int i=1;i<=n;i++)
		if(dcmp(t=(a[i].sec-mid*a[i].fir))<0)
			tot-=t;
	//cout<<tot<<" "<<mid<<endl;
	return dcmp(mid*p-tot)>=0;
}
double Divide_Conquer(double l,double r){
	double mid;
	int cntt=0;
	while((++cntt)<=lmt){
		mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	return !dcmp(l-INF)?-1:l;
}
int main()
{
	read();
	//cout<<check(2.1)<<endl;
	printf("%.5f\n",Divide_Conquer(0,INF));
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<iostream>
#include<queue>
#include<stack>
#include<cassert>
#include<set>
#include<map>
#define y1 dnjsfndkls
#define pb push_back
#define fir first
#define sec second
#define tm suifhsduifhais
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const double PI=acos(-1.0);
template<class T>
void Read(T &x){
    char c;
    bool f=0;
    while(c=getchar(),c!=EOF)
        if(c=='-') f=1;
        else if(c>='0'&&c<='9'){
            x=c-'0';
            while(c=getchar(),c>='0'&&c<='9')
                x=x*10+c-'0';
            ungetc(c,stdin);
            if(f) x=-x;
            return ;
        }
}
//***************************************

#define INF 1e10+5
#define eps 1e-8
#define MAXN 100000
#define lmt 100

int n,p;
pii a[MAXN+10];

int dcmp(double x){
	return fabs(x)<eps?0:(x<0?-1:1);
}
void read(){
	LL tmp=0;
	Read(n),Read(p);
	for(int i=1;i<=n;i++){
		Read(a[i].fir),Read(a[i].sec);
		tmp+=a[i].fir;
	}
	if(tmp<=p){
		puts("-1");
		exit(0);
	}
}
bool check(double mid){
	double t,tot=0;
	for(int i=1;i<=n;i++)
		if(dcmp(t=(a[i].sec-mid*a[i].fir))<0)
			tot-=t;
	//cout<<tot<<" "<<mid<<endl;
	return dcmp(mid*p-tot)>=0;
}
double Divide_Conquer(double l,double r){
	double mid;
	int cntt=0;
	while((++cntt)<=lmt){
		mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	return !dcmp(l-INF)?-1:l;
}
int main()
{
	//freopen("1.out","r",stdin);
	read();
	printf("%.5f\n",Divide_Conquer(0,INF));
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<iostream>
#include<queue>
#include<stack>
#include<cassert>
#include<set>
#include<map>
#define y1 dnjsfndkls
#define pb push_back
#define fir first
#define sec second
#define tm suifhsduifhais
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const double PI=acos(-1.0);
template<class T>
void Read(T &x){
    char c;
    bool f=0;
    while(c=getchar(),c!=EOF)
        if(c=='-') f=1;
        else if(c>='0'&&c<='9'){
            x=c-'0';
            while(c=getchar(),c>='0'&&c<='9')
                x=x*10+c-'0';
            ungetc(c,stdin);
            if(f) x=-x;
            return ;
        }
}
//***************************************

#define INF 1e12
#define eps 1e-8
#define MAXN 100000
#define lmt 100

int n,p;
pii a[MAXN+10];

int dcmp(double x){
	return fabs(x)<eps?0:(x<0?-1:1);
}
void read(){
	Read(n),Read(p);
	for(int i=1;i<=n;i++)
		Read(a[i].fir),Read(a[i].sec);
}
bool check(double mid){
	double t,tot=0;
	for(int i=1;i<=n;i++)
		if(dcmp(t=(a[i].sec-mid*a[i].fir))<0)
			tot-=t;
	//cout<<tot<<" "<<mid<<endl;
	return dcmp(mid*p-tot)>=0;
}
double Divide_Conquer(double l,double r){
	double mid;
	int cntt=0;
	while((++cntt)<=lmt){
		mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	return !dcmp(l-INF)?-1:l;
}
int main()
{
	//freopen("1.out","r",stdin);
	read();
	//cout<<check(2.1)<<endl;
	printf("%.5f\n",Divide_Conquer(0,INF));
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define K 1015
#define MP make_pair
#define F first
#define S second
#define FASTIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lp(i,n) for(int i=0;i<n;i++)
const int MOD = 1e9 + 7;

void read() {
    freopen("in", "r", stdin);
}
long double EPS=1e-9;
typedef long long ll;
typedef pair<int, int> pi;
#define N (100*K)
int n,m,k;
int a[N],b[N];
ll p;
bool check(long double t){
    long double provide=t*p;
    for(int i=0;i<n;i++){
        if(t*a[i]>b[i]){
            provide-=(t*a[i]-b[i]);
        }
        if(provide<EPS)return 0;
    }
    return 1;
}
int main() {
    cin>>n>>p;

    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        sum+=a[i];
    }
    if(sum<=p){
        cout<<-1<<endl;
        return 0;
    }
    long double l=0,r=10000000000000;
    while(r-l>EPS){
        long double mid=(l+r)/2;
        if(check(mid)){
            l=mid;
        }
        else
            r=mid;
    }
    cout<<fixed<<setprecision(6)<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define K 1015
#define MP make_pair
#define F first
#define S second
#define FASTIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lp(i,n) for(int i=0;i<n;i++)
const int MOD = 1e9 + 7;

void read() {
    freopen("in", "r", stdin);
}
long double EPS=1e-7;
typedef long long ll;
typedef pair<int, int> pi;
#define N (100*K)
int n,m,k;
int a[N],b[N];
ll p;
bool check(long double t){
    long double provide=t*p;
    for(int i=0;i<n;i++){
        if(t*a[i]>b[i]){
            provide-=(t*a[i]-b[i]);
        }
        if(provide<EPS)return 0;
    }
    return 1;
}
int main() {
    cin>>n>>p;

    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        sum+=a[i];
    }
    if(sum<p){
        cout<<-1<<endl;
        return 0;
    }
    long double l=0,r=10000000000000;
    while(r-l>EPS){
        long double mid=(l+r)/2;
        if(check(mid)){
            l=mid;
        }
        else
            r=mid;
    }
    cout<<fixed<<setprecision(6)<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define K 1015
#define MP make_pair
#define F first
#define S second
#define FASTIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lp(i,n) for(int i=0;i<n;i++)
const int MOD = 1e9 + 7;

void read() {
    freopen("in", "r", stdin);
}
long double EPS=1e-9;
typedef long long ll;
typedef pair<int, int> pi;
#define N (100*K)
int n,m,k;
int a[N],b[N];
ll p;
bool check(long double t){
    long double provide=t*p;
    for(int i=0;i<n;i++){
        if(t*a[i]>b[i]){
            provide-=(t*a[i]-b[i]);
        }
        if(provide<EPS)return 0;
    }
    return 1;
}
int main() {
    cin>>n>>p;

    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        sum+=a[i];
    }
    if(sum<p){
        cout<<-1<<endl;
        return 0;
    }
    long double l=0,r=10000000000000;
    while(r-l>EPS){
        long double mid=(l+r)/2;
        if(check(mid)){
            l=mid;
        }
        else
            r=mid;
    }
    cout<<fixed<<setprecision(6)<<l<<endl;
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef double db;
const int MAXN=100005;
int a[MAXN],b[MAXN];
int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i],&b[i]);
    db l=0,r=1e18;
    for(int _=0;_<100;_++)
    {
        db m=(l+r)/2,sum=0;
        for(int i=1;i<=n;i++)
            sum+=max(0.0,a[i]*m-b[i]);
        if(sum>p*m)r=m;
        else l=m;
    }
    if(l>1e16)printf("-1\n");
    else printf("%.12f\n",l);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef double db;
const int MAXN=100005;
int a[MAXN],b[MAXN];
int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i],&b[i]);
    db l=0,r=1e18;
    for(int _=0;_<100;_++)
    {
        db m=(l+r)/2,sum=0;
        for(int i=1;i<=n;i++)
            sum+=max(0.0,a[i]*m-b[i])/p;
        if(sum>m)r=m;
        else l=m;
    }
    if(l>1e16)printf("-1\n");
    else printf("%.12f\n",l);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef double db;
const int MAXN=100005;
int a[MAXN],b[MAXN];
int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i],&b[i]);
    int sum=0;
    db l=0,r=1e18;
    for(int _=0;_<100;_++)
    {
        db m=(l+r)/2,sum=0;
        for(int i=1;i<=n;i++)
            sum+=max(0.0L,a[i]*m-b[i])/p;
        if(sum>m)r=m;
        else l=m;
    }
    if(l>1e16)printf("-1\n");
    else printf("%.12f\n",l);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long double db;
const int MAXN=100005;
int a[MAXN],b[MAXN];
int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i],&b[i]);
    db l=0,r=1e18;
    for(int _=0;_<100;_++)
    {
        db m=(l+r)/2,sum=0;
        for(int i=1;i<=n;i++)
            sum+=max(0.0L,a[i]*m-b[i]);
        if(sum>p*m)r=m;
        else l=m;
    }
    if(l>1e16)printf("-1\n");
    else printf("%.12f\n",(double)l);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,p;
const int N=100005;
int a[N],b[N];
LL suma,sumb;
bool can(double x)
{
    double sum=0;
    for(int i=1;i<=n;++i)
        sum+=max(0.0,a[i]*x-b[i]);
    return sum<=p*x;
}
double bin(double l,double r)
{
    while((r-l)>1e-6)
    {
        double mid=0.5*(l+r);
        if(can(mid))
            l=mid;
        else r=mid;
    }
    return 0.5*(l+r);
}
int main()
{
    scanf("%d%d",&n,&p);
    for(int i=1;i<=n;++i)
    {
        scanf("%d%d",a+i,b+i);
        suma+=a[i];
        sumb+=b[i];
    }
    if(p>=suma)
    {
        puts("-1");
        return 0;
    }
    printf("%f\n",bin(0,1.0*sumb/(suma-p)));
    /// t*p + sumb == t*suma
    /// t(suma-p) == sumb;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,p;
const int N=100005;
int a[N],b[N];
LL suma,sumb;
bool can(double x)
{
    double sum=0,t;
    for(int i=1;i<=n;++i)
    {
        t=a[i]*x-b[i];
        if(t>=0)
            sum+=t;
        if(sum>p*x)
            return 0;
    }
    return 1;
}
double bin(double l,double r)
{
    while((r-l)>1e-5)
    {
        double mid=0.5*(l+r);
        if(can(mid))
            l=mid;
        else r=mid;
    }
    return 0.5*(l+r);
}
int main()
{
    scanf("%d%d",&n,&p);
    for(int i=1;i<=n;++i)
    {
        scanf("%d%d",a+i,b+i);
        suma+=a[i];
        sumb+=b[i];
    }
    if(p>=suma)
    {
        puts("-1");
        return 0;
    }
    printf("%f\n",bin(0,1.0*sumb/(suma-p)));
    /// t*p + sumb == t*suma
    /// t(suma-p) == sumb;
    return 0;
}


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

int N, P, A[100005], B[100005];

bool attempt(double x) {
	double ans = 0;
	for (int i = 0; i < N; i++) {
		double sustain = (double)B[i] / A[i];
		if (sustain >= x) continue;
		double deficit = x - sustain;
		ans += deficit * A[i] / P;
	}
	return ans <= x;
}

int main() {
	scanf("%d%d", &N, &P);
	for (int i = 0; i < N; i++) scanf("%d%d", &A[i], &B[i]);
	double bot = 0, top = 20000000001ll, mid;
	while (bot + 1e-05 < top) {
		mid = (bot + top)/2;
		if (attempt(mid)) bot = mid;
		else top = mid;
	}
	if (bot < 15000000000ll) printf("%.5lf\n", bot);
	else printf("-1\n");
}


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

int N, P, A[100005], B[100005];

bool attempt(double x) {
	double ans = 0;
	for (int i = 0; i < N; i++) {
		double sustain = (double)B[i] / A[i];
		if (sustain >= x) continue;
		double deficit = x - sustain;
		ans += deficit * A[i] / P;
	}
	return ans <= x;
}

int main() {
	scanf("%d%d", &N, &P);
	for (int i = 0; i < N; i++) scanf("%d%d", &A[i], &B[i]);
	double bot = 0, top = 100000000001ll, mid;
	while (bot + 1e-05 < top) {
		mid = (bot + top)/2;
		if (attempt(mid)) bot = mid;
		else top = mid;
	}
	if (bot < 10000000000ll) printf("%.5lf\n", bot);
	else printf("-1\n");
}


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

int N, P, A[100005], B[100005];

bool attempt(double x) {
	double ans = 0;
	for (int i = 0; i < N; i++) {
		double sustain = (double)B[i] / A[i];
		if (sustain >= x) continue;
		double deficit = x - sustain;
		ans += deficit * A[i] / P;
	}
	return ans <= x;
}

int main() {
	scanf("%d%d", &N, &P);
	for (int i = 0; i < N; i++) scanf("%d%d", &A[i], &B[i]);
	double bot = 0, top = 10000000000001ll, mid;
	while (bot + 1e-05 < top) {
		mid = (bot + top)/2;
		if (attempt(mid)) bot = mid;
		else top = mid;
	}
	if (bot < 10000000000000ll) printf("%.5lf\n", bot);
	else printf("-1\n");
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
#define all(a) (a).begin(), (a).end()
#define ms(a,v) memset(a, v, sizeof(a))
#define sz(v) ((int)(v).size())
#define mp make_pair
#define pb push_back
#define prev biiiiirl_sai_de_casa_comi_pra_caralho
#define next trapezio_descendente
#define index eh_ele_que_nos_vai_buscar
#define left aqui_eh_37_anos_porra
#define R32 ({int32_t x; scanf("%d", &x); x;})
#define RL ({long long x; scanf("%lld", &x); x;})
#define RC ({char x; scanf(" %c", &x); x;})
#define RI RL
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;

typedef long double LD;

const int N = 1e6;
const LD EPS = 1e-9;
int a[N], b[N];

int n, p;

bool check(LD t){
    LD rem = t;
    for(int i = 0; i < n; i++){
        LD x = 1.0L*b[i]/a[i];
        if(x > t-EPS) continue;
        // (b[i]+y)/a[i] = t
        LD y = t*a[i]-b[i];
        LD needed = y/p;
        if(needed > rem+EPS) return false;
        rem = max(0.L, rem-needed);
    }

    return true;
}

int32_t main(){
    n = RI;
    p = RI;

    int consume = 0;
    for(int i = 0;i < n; i++){
        a[i] = RI;
        b[i] = RI;
        consume += a[i];
    }

    if(p >= consume){
        cout << -1 << endl;
        return 0;
    }

    LD l = 0, r = 1e12;
    for(int i = 0; i < 100; i++){
        LD mid = (l+r)/2;
        if(check(mid))
            l = mid;
        else r = mid;
    }

    cout << fixed << setprecision(11);
    cout << l << endl;
}


// EDIT YOUR TEMPLATE AT ~/.cftool/template.cpp

#include <bits/stdc++.h>

using namespace std;

int main(){

}


#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;

const int N = 100005;
int n, p;
int a[N], b[N];

inline bool check(double limit)
{
	double need = 0;
	for (int i = 1; i <= n; i ++){
		if (b[i]-a[i]*limit < 0){
			need += a[i]*limit - b[i];
		}
	}
	//printf("need = %.10lf\n", need);
	return need <= p*limit;
}

int main()
{
	scanf("%d%d", &n, &p);
	LL sum = 0;
	for (int i = 1; i <= n; i ++){
		scanf("%d%d", &a[i], &b[i]);
		sum += a[i];
	}
	if (sum <= p){
		puts("-1");
		return 0;
	}
	//printf("%d\n", check(0.5));
	double l = 0, r = 1000000000, mid;
	for (int i = 0; i < 60; i ++){
		mid = (l+r)/2;
		if (check(mid)) l = mid;
		else r = mid;
	}
	mid = (l+r)/2;
	printf("%.10lf\n", mid);
	return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;

const int N = 100005;
int n, p;
int a[N], b[N];

inline bool check(double limit)
{
	double need = 0;
	for (int i = 1; i <= n; i ++){
		if (b[i]-a[i]*limit < 0){
			need += a[i]*limit - b[i];
		}
	}
	//printf("need = %.10lf\n", need);
	return need <= p*limit;
}

int main()
{
	scanf("%d%d", &n, &p);
	LL sum = 0;
	for (int i = 1; i <= n; i ++){
		scanf("%d%d", &a[i], &b[i]);
		sum += a[i];
	}
	if (sum <= p){
		puts("-1");
		return 0;
	}
	//printf("%d\n", check(0.5));
	double l = 0, r = 10000000000000, mid;
	for (int i = 0; i < 60; i ++){
		mid = (l+r)/2;
		if (check(mid)) l = mid;
		else r = mid;
	}
	mid = (l+r)/2;
	printf("%.10lf\n", mid);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
#define eps 1e-9
double p;
bool chk(double limit){
    vector<double>need_to(n);
    double old = limit;
    limit *= p;
    vector<pair<int,double> >v;
    for(int i = 0; i < n; i++){
       need_to[i] = max(0.0,(a[i].F * old) - a[i].S + eps);
       v.push_back({p - a[i].F+eps,need_to[i]});
    }
    double cut = 0.0;
    for(int i = 0; i < v.size(); i++){
        double azwd = need_to[i]/p;
        double x = a[i].S - (cut * a[i].F) + eps;
        if(x <= 0.0)
            return 0;
        x+=(p*azwd);
        x-=(azwd * a[i].F);

        if(x < 0.0)
            return 0;

        cut += (azwd);
    }
    return cut-eps <= limit;
}
bool cmp(pair<double, double>o,pair<double,double>x){
    return p - o.F < p - x.F;
}
int main(){
    scanf("%d%lf", &n, &p);
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S);
    sort(a,a + n, cmp);
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
double p;
bool chk(double limit){
    vector<double>need_to(n);
    double old = limit;
    limit *= p;
    vector<pair<int,double> >v;
    for(int i = 0; i < n; i++){
       need_to[i] = max(0.0,(a[i].F * old) - a[i].S);
       v.push_back({p - a[i].F,need_to[i]});
    }
    double cut = 0.0;
    for(int i = 0; i < v.size(); i++){
        double azwd = need_to[i]/p;

        double x = a[i].S - (cut * a[i].F);
        if(x < 0.0)
            return 0;
        x+=(p*azwd);
        x-=(azwd * a[i].F);
        if(x < 0.0)
            return 0;
        cut += (azwd);
    }
    return cut <= limit;
}
bool cmp(pair<double, double>o,pair<double,double>x){
    return p - o.F < p - x.F;
}
int main(){
    scanf("%d%lf", &n, &p);
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S);
    sort(a,a + n, cmp);
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
double p;
bool chk(double limit){
    double cur = 0.0;
    double old = limit;
    limit *= p;
    for(int i = 0; i < n; i++){
        double x = (a[i].F*old) - a[i].S;
       cur += max(0.0,x);
    }
    return cur<= limit;
}
int main(){
    scanf("%d%lf", &n, &p);
    double sum = 0;
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S),sum+=a[i].F;
    if(p >= sum)
        return puts("-1");
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
#define eps 1e-9
double p;
bool chk(double limit){
    vector<double>need_to(n);
    double old = limit;
    limit *= p;
    vector<pair<int,double> >v;
    for(int i = 0; i < n; i++){
       need_to[i] = max(0.0,(a[i].F * old) - a[i].S + eps);
       v.push_back({p - a[i].F+eps,need_to[i]});
    }
    double cut = 0.0;
    for(int i = 0; i < v.size(); i++){
        double azwd = need_to[i]/p;
        double x = a[i].S - (cut * a[i].F) + eps;
        if(x <= 0.0)
            return 0;
        x+=(p*azwd);
        x-=(azwd * a[i].F);

        if(x < 0.0)
            return 0;

        cut += (azwd);
    }
    return cut-eps <= limit;
}
bool cmp(pair<double, double>o,pair<double,double>x){
    return o.S <  x.S;
}
int main(){
    scanf("%d%lf", &n, &p);
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S);
    sort(a,a + n, cmp);
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
double p;
bool chk(double limit){
    vector<double>need_to(n);
    double old = limit;
    limit *= p;
    vector<pair<int,double> >v;
    for(int i = 0; i < n; i++){
       need_to[i] = max(0.0,(a[i].F * old) - a[i].S);
       v.push_back({p - a[i].F,need_to[i]});
    }
    double cut = 0.0;
    for(int i = 0; i < v.size(); i++){
        double azwd = need_to[i]/p;

        double x = a[i].S - (cut * a[i].F);
        if(x < 0.0)
            return 0;
        x+=(p*azwd);
        x-=(azwd * a[i].F);
        if(x < 0.0)
            return 0;
        cut += (azwd);
    }
    return cut <= limit;
}
bool cmp(pair<double, double>o,pair<double,double>x){
    return p - o.F < p - x.F || (p-o.F == p-x.F && o.S < x.S);
}
int main(){
    scanf("%d%lf", &n, &p);
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S);
    sort(a,a + n, cmp);
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
double p;
bool chk(double limit){
    vector<double>need_to(n);
    double old = limit;
    limit *= p;
    vector<pair<int,double> >v;
    for(int i = 0; i < n; i++){
       need_to[i] = max(0.0,(a[i].F * old) - a[i].S);
       v.push_back({p - a[i].F,need_to[i]});
    }
    double cut = 0.0;
    for(int i = 0; i < v.size(); i++){
        double azwd = need_to[i]/p;

        double x = a[i].S - (cut * a[i].F);
        if(x < 0.0)
            return 0;
        x+=(p*azwd);
        x-=(azwd * a[i].F);
        if(x < 0.0)
            return 0;
        cut += (azwd);
    }
    return cut <= limit;
}
bool cmp(pair<double, double>o,pair<double,double>x){
    return p - o.F < p - x.F || (p-o.F == p-x.F && o.S < x.S);
}
int main(){
    scanf("%d%lf", &n, &p);
    double sum = 0;
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S), sum += a[i].F;
    if(p >= sum)
        return puts("-1");
    sort(a,a + n, cmp);
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
pair<double, double>a[100005];
int n;
#define eps 1e-9
double p;
bool chk(double limit){
    vector<double>need_to(n);
    double old = limit;
    limit *= p;
    vector<pair<int,double> >v;
    for(int i = 0; i < n; i++){
       need_to[i] = max(0.0,(a[i].F * old) - a[i].S + eps);
       v.push_back({p - a[i]+eps.F,need_to[i]});
    }
    double cut = 0.0;
    for(int i = 0; i < v.size(); i++){
        double azwd = need_to[i]/p;
        double x = a[i].S - (cut * a[i].F) + eps;
        if(x <= 0.0)
            return 0;
        x+=(p*azwd);
        x-=(azwd * a[i].F);

        if(x < 0.0)
            return 0;

        cut += (azwd);
    }
    return cut-eps <= limit;
}
bool cmp(pair<double, double>o,pair<double,double>x){
    return p - o.F < p - x.F;
}
int main(){
    scanf("%d%lf", &n, &p);
    for(int i = 0; i < n; i++)
        scanf("%lf%lf", &a[i].F, &a[i].S);
    sort(a,a + n, cmp);
    double lo = 0, hi = 1e18;
    for(int i = 0; i < 100; i++){
        double md = (lo + hi)/2;
        if(chk(md))
            lo =md;
        else
            hi = md;
    }
    if(lo >= 1e17)
        return 0 * puts("-1");
    cout << fixed << setprecision(4) << lo << endl;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

typedef long long int64;
const int kMaxN = 1e5+10;
const int64 kInf = (1LL<<60);

int n, p;
int a[kMaxN], b[kMaxN];

bool check(double time) {
	double spare = p;
	for (int i = 1; i <= n; ++i) {
		double left = b[i] - a[i] * time;
		if (left < 0) {
			left /= time;
			if (spare >= -left) {
				spare += left;
			} else {
				return false;
			}
		}
	}
	return true;
}

void solve() {
	cin >> n >> p;

	long long A = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i] >> b[i];
		A += a[i];
	}

	if (A < p) {
		cout << -1 << "\n";
		return;
	}

	double lo = 0, hi = 1e10;
	int times = 100;

	while (times) {
		double mid = (lo + hi)/2;
		if (check(mid)) {
			lo = mid;
		} else {
			hi = mid;
		}
		--times;
	}

	cout << fixed << setprecision(6) << lo << "\n";
}

void reset() {
}

int main() {
	int tests = 1;

	for (;tests; --tests) {
		solve();
		reset();
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

typedef long long int64;
const int kMaxN = 1e5+10;
const int64 kInf = (1LL<<60);

int n, p;
int a[kMaxN], b[kMaxN];

bool check(double time) {
	double spare = p;
	for (int i = 1; i <= n; ++i) {
		double left = b[i] - a[i] * time;
		if (left < 0) {
			left /= time;
			if (spare >= -left) {
				spare += left;
			} else {
				return false;
			}
		}
	}
	return true;
}

void solve() {
	cin >> n >> p;

	long long A = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i] >> b[i];
		A += a[i];
	}

	if (A < p) {
		cout << -1 << "\n";
		return;
	}

	double lo = 0, hi = 1e10;
	int times = 100;

	while (times) {
		double mid = (lo + hi)/2;
		if (check(mid)) {
			lo = mid;
		} else {
			hi = mid;
		}
		--times;
	}

	cout << fixed << setprecision(6) << lo << "\n";
}

void reset() {
}

int main() {
	int tests = 3;

	for (;tests; --tests) {
		solve();
		reset();
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

typedef long long int64;
const int kMaxN = 1e5+10;
const int64 kInf = (1LL<<60);

int n, p;
int a[kMaxN], b[kMaxN];

bool check(double time) {
	double spare = p;
	for (int i = 1; i <= n; ++i) {
		double left = b[i] - a[i] * time;
		if (left < 0) {
			left /= time;
			if (spare >= -left) {
				spare += left;
			} else {
				return false;
			}
		}
	}
	return true;
}

void solve() {
	cin >> n >> p;

	long long A = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i] >> b[i];
		A += a[i];
	}

	if (A <= p) {
		cout << -1 << "\n";
		return;
	}

	double lo = 0, hi = 1e10;
	int times = 100;

	while (times) {
		double mid = (lo + hi)/2;
		if (check(mid)) {
			lo = mid;
		} else {
			hi = mid;
		}
		--times;
	}

	cout << fixed << setprecision(6) << lo << "\n";
}

void reset() {
}

int main() {
	int tests = 1;

	for (;tests; --tests) {
		solve();
		reset();
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

typedef long long int64;
const int kMaxN = 1e5+10;
const int64 kInf = (1LL<<60);

int n, p;
int a[kMaxN], b[kMaxN];

bool check(double time) {
	double spare = p * time;
	for (int i = 1; i <= n; ++i) {
		double left = b[i] - a[i] * time;
		if (left < 0) {
			if (spare >= -left) {
				spare += left;
			} else {
				return false;
			}
		}
	}
	return true;
}

void solve() {
	cin >> n >> p;

	for (int i = 1; i <= n; ++i) {
		cin >> a[i] >> b[i];
	}

	double lo = 0, hi = 1e13;
	int times = 100;

	while (times) {
		double mid = (lo + hi)/2;
		if (check(mid)) {
			lo = mid;
		} else {
			hi = mid;
		}
		--times;
	}

	if (fabs(lo - 1e13) <= 1) {
		cout << -1 << "\n";
	} else {
		cout << fixed << setprecision(6) << lo << "\n";
	}
}

void reset() {
}

int main() {
	int tests = 1;

	for (;tests; --tests) {
		solve();
		reset();
	}
}


#include <cstdio>
#include <algorithm>
using namespace std;
typedef long double ld;
const int MAXN=110000;
const ld EPS=1E-6;
int n, p;
int a[MAXN], b[MAXN];
bool check(ld k)
{
	ld sum=0;
	for (int i=1; i<=n; i++)
		sum+=max(a[i]*k-b[i], (ld)0);
	return sum<=p*k;
}
int main()
{
//	freopen("A.in", "r", stdin);
//	freopen("A.out", "w", stdout);
	scanf("%d%d", &n, &p);
	for (int i=1; i<=n; i++)
		scanf("%d%d", &a[i], &b[i]);
	ld l=0, r=1E12+666;
	while (r-l>EPS)
	{
		ld mid=(l+r)/2;
		if (check(mid)) l=mid;
		else r=mid;
	}
	if (l>1E12+233) puts("-1");
	else printf("%.5lf\n", (double)l);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=110000;
const double EPS=1E-5;
int n, p;
int a[MAXN], b[MAXN];
bool check(double k)
{
	double sum=0;
	for (int i=1; i<=n; i++)
		sum+=max(a[i]*k-b[i], 0.0);
	return sum<=p*k;
}
int main()
{
//	freopen("A.in", "r", stdin);
//	freopen("A.out", "w", stdout);
	scanf("%d%d", &n, &p);
	for (int i=1; i<=n; i++)
		scanf("%d%d", &a[i], &b[i]);
	double l=0, r=100666;
	while (r-l>EPS)
	{
		double mid=(l+r)/2;
		if (check(mid)) l=mid;
		else r=mid;
	}
	if (l>100233) puts("-1");
	else printf("%.5lf\n", l);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=110000;
const double EPS=1E-5;
int n, p;
int a[MAXN], b[MAXN];
bool check(double k)
{
	double sum=0;
	for (int i=1; i<=n; i++)
		sum+=max(a[i]*k-b[i], 0.0);
	return sum<=p*k;
}
int main()
{
//	freopen("A.in", "r", stdin);
//	freopen("A.out", "w", stdout);
	scanf("%d%d", &n, &p);
	for (int i=1; i<=n; i++)
		scanf("%d%d", &a[i], &b[i]);
	double l=0, r=1E9+666;
	while (r-l>EPS)
	{
		double mid=(l+r)/2;
		if (check(mid)) l=mid;
		else r=mid;
	}
	if (l>1E9+233) puts("-1");
	else printf("%.5lf\n", l);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
typedef long double ld;
const int MAXN=110000;
const ld EPS=1E-6;
int n, p;
int a[MAXN], b[MAXN];
bool check(ld k)
{
	ld sum=0;
	for (int i=1; i<=n; i++)
		sum+=max(a[i]*k-b[i], (ld)0);
	return sum<=p*k;
}
int main()
{
//	freopen("A.in", "r", stdin);
//	freopen("A.out", "w", stdout);
	scanf("%d%d", &n, &p);
	for (int i=1; i<=n; i++)
		scanf("%d%d", &a[i], &b[i]);
	ld l=0, r=1E9+666;
	while (r-l>EPS)
	{
		ld mid=(l+r)/2;
		if (check(mid)) l=mid;
		else r=mid;
	}
	if (l>1E9+233) puts("-1");
	else printf("%.5lf\n", (double)l);
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
typedef long double ld;
const int MAXN=110000;
const ld EPS=1E-6;
int n, p;
int a[MAXN], b[MAXN];
bool check(ld k)
{
	ld sum=0;
	for (int i=1; i<=n; i++)
		sum+=max(a[i]*k-b[i], (ld)0);
	return sum<=p*k;
}
int main()
{
//	freopen("A.in", "r", stdin);
//	freopen("A.out", "w", stdout);
	scanf("%d%d", &n, &p);
	for (int i=1; i<=n; i++)
		scanf("%d%d", &a[i], &b[i]);
	ld l=0, r=1E10+666;
	while (r-l>EPS)
	{
		ld mid=(l+r)/2;
		if (check(mid)) l=mid;
		else r=mid;
	}
	if (l>1E10+233) puts("-1");
	else printf("%.5lf\n", (double)l);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int MAX = 100000 + 5;

ll cons[MAX],stored[MAX];
int n;
ll p;

bool check(ld t)
{
    ld have = t*p;
    for(int i=0;i<n;i++)
        have -= max(cons[i]*t - stored[i],ld(0));
    return have>=0;
}

int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>cons[i]>>stored[i];
    ld s=0,sz=1e11,best=-1;
    while(sz>=1e-15)
    {
        sz/=2;
        ld mid=s+sz;
        if(check(mid))
            s=mid;
    }
    if(s>1e10+1)
        cout<<"-1\n";
    else
        cout<<setprecision(9)<<fixed<<s+sz/2<<"\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int MAX = 100000 + 5;

ll cons[MAX],stored[MAX];
int n;
ll p;

bool check(ld t)
{
    ld have = t*p;
    for(int i=0;i<n;i++)
        have -= max(cons[i]*t - stored[i],ld(0));
    return have>=0;
}

int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>cons[i]>>stored[i];
    ld s=0,sz=1e11,best=-1;
    while(sz>=1e-15)
    {
        sz/=2;
        ld mid=s+sz;
        if(check(mid))
            s=mid;
    }
    ld ten=1;
    for(int i=0;i<10;i++)
        ten*=10;
    if(s>ten+1)
        cout<<"-1\n";
    else
        cout<<setprecision(9)<<fixed<<s+sz/2<<"\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int MAX = 100000 + 5;

ll cons[MAX],stored[MAX];
int n;
ll p;

bool check(ld t)
{
    ld have = t*p;
    for(int i=0;i<n;i++)
        have -= max(cons[i]*t - stored[i],ld(0));
    return have>=0;
}

int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>cons[i]>>stored[i];
    ld s=0,sz=1e11,best=-1;
    while(sz>=1e-15)
    {
        sz/=2;
        ld mid=s+sz;
        if(check(mid))
            s=mid;
    }
    if(s>5e10)
        cout<<"-1\n";
    else
        cout<<setprecision(9)<<fixed<<s+sz/2<<"\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int MAX = 100000 + 5;

ll cons[MAX],stored[MAX];
int n;
ll p;

bool check(ld t)
{
    ld have = t*p;
    for(int i=0;i<n;i++)
        have -= max(cons[i]*t - stored[i],ld(0));
    return have>=0;
}

int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>cons[i]>>stored[i];
    ld s=0,sz=1e11,best=-1;
    while(sz>=1e-15)
    {
        sz/=2;
        ld mid=s+sz;
        if(check(mid))
            s=mid;
    }
    if(s>1e10)
        cout<<"-1\n";
    else
        cout<<setprecision(9)<<fixed<<s+sz/2<<"\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int MAX = 100000 + 5;

ll cons[MAX],stored[MAX];
int n;
ll p;

bool check(ld t)
{
    ld have = t*p;
    for(int i=0;i<n;i++)
        have -= max(cons[i]*t - stored[i],ld(0));
    return have>=0;
}

int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>cons[i]>>stored[i];
    ld s=0,sz=1e11,best=-1;
    while(sz>=1e-15)
    {
        sz/=2;
        ld mid=s+sz;
        if(check(mid))
            s=mid;
    }
    if(s>powl(10,10)+1)
        cout<<"-1\n";
    else
        cout<<setprecision(9)<<fixed<<s+sz/2<<"\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

const int MAX = 100000 + 5;

ll cons[MAX],stored[MAX];
int n;
ll p;

bool check(ld t)
{
    ld have = t*p;
    for(int i=0;i<n;i++)
        have -= max(cons[i]*t - stored[i],ld(0));
    return have>=0;
}

int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>cons[i]>>stored[i];
    ld s=0,sz=1e11,best=-1;
    while(sz>=1e-15)
    {
        sz/=2;
        ld mid=s+sz;
        if(check(mid))
            s=mid;
    }
    if(s>ld(1e10)+1)
        cout<<"-1\n";
    else
        cout<<setprecision(9)<<fixed<<s+sz/2<<"\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 10;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

bool comp (pii p1, pii p2) {
	return 1ll * p1.fi * p2.se < 1ll * p1.se * p2.fi;
}

int N, P;
pii A[MAXN];

bool moo (double g) {
	double tot = 0;
	for (int i = 0; i < N; i++) {
		//the amount of time you need to charge it
		tot += max(0.0, (g * A[i].fi - A[i].se));
	}
	return tot <= g * P;
}

int main() {
	scanf("%d %d", &N, &P);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &A[i].fi, &A[i].se);
	}
	sort(A, A + N, comp);

	double lo = 0, hi = 1e8;
	bool haslim = false;

	for (int it = 0; it < 100; it++) {
		double mid = (lo + hi) / 2;
		if (moo(mid)) {
			lo = mid;
		} else {
			hi = mid;
			haslim = true;
		}
	}

	if (!haslim) {
		puts("-1");
		return 0;
	}
	printf("%.10lf\n", lo);
}


#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 10;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

bool comp (pii p1, pii p2) {
	return 1ll * p1.fi * p2.se < 1ll * p1.se * p2.fi;
}

int N, P;
pii A[MAXN];

bool moo (double g) {
	double tot = 0;
	for (int i = 0; i < N; i++) {
		//the amount of time you need to charge it
		tot += max(0.0, (g * A[i].fi - A[i].se));
	}
	return tot <= g * P;
}

int main() {
	scanf("%d %d", &N, &P);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &A[i].fi, &A[i].se);
	}
	sort(A, A + N, comp);

	double lo = 0, hi = 1e16;
	bool haslim = false;

	for (int it = 0; it < 100; it++) {
		double mid = (lo + hi) / 2;
		if (moo(mid)) {
			lo = mid;
		} else {
			hi = mid;
			haslim = true;
		}
	}

	if (!haslim) {
		puts("-1");
		return 0;
	}
	printf("%.10lf\n", lo);
}


#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 10;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

bool comp (pii p1, pii p2) {
	return 1ll * p1.fi * p2.se < 1ll * p1.se * p2.fi;
}

int N, P;
pii A[MAXN];

bool moo (double g) {
	double tot = 0;
	for (int i = 0; i < N; i++) {
		//the amount of time you need to charge it
		tot += max(0.0, (g * A[i].fi - A[i].se));
	}
	return tot <= g * P;
}

int main() {
	scanf("%d %d", &N, &P);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &A[i].fi, &A[i].se);
	}
	sort(A, A + N, comp);

	double lo = 0, hi = 1e16;
	bool haslim = false;

	for (int it = 0; it < 100; it++) {
		double mid = (lo + hi) / 2;
		if (moo(mid)) {
			lo = mid;
		} else {
			hi = mid;
		}
	}

	if (lo > 5e14) {
		puts("-1");
		return 0;
	}
	printf("%.10lf\n", lo);
}


#include <bits/stdc++.h>

using namespace std;
const int MAXN = 1e5 + 10;

int N, P, A[MAXN], B[MAXN];

bool moo (double g) {
	double tot = 0;
	for (int i = 0; i < N; i++) {
		tot += max(0.0, A[i] * g - B[i]);
	}
	return g * P > tot;
}

int main() {
	scanf("%d %d", &N, &P);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &A[i], &B[i]);
	}

	double lo = 0, hi = 1e16;
	bool haslim = false;
	for (int it = 0; it < 100; it++) {
		double mid = (lo + hi) / 2;
		if (moo(mid)) {
			lo = mid;
		} else {
			haslim = true;
			hi = mid;
		}
	}

	if (haslim) {
		printf("%.10lf\n", lo);
	} else {
		puts("-1");
	}
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

int A[MAXN];
int B[MAXN];
int n;
ll p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += max(0.0, (time * A[i] - B[i]) / p);
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    ll total = 0;
    for(int i = 0; i < n; i++) {
        scanf("%d %d", &A[i], &B[i]);
        total += A[i];
    }
    if(total < p) {
        cout << -1 << endl;
        return 0;
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

double A[MAXN];
double B[MAXN];
int n, p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += max(0.0, (time * A[i] - B[i]) / p);
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    for(int i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

int A[MAXN];
int B[MAXN];
int n;
ll p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += max(0.0, (time * A[i] - B[i]) / p);
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    ll total = 0;
    for(int i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
        total += A[i];
    }
    if(total < p) {
        cout << -1 << endl;
        return 0;
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

int A[MAXN];
int B[MAXN];
int n;
int p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += max(0.0, (time * A[i] - B[i]) / p);
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    ll total = 0;
    for(int i = 0; i < n; i++) {
        scanf("%d %d", &A[i], &B[i]);
        total += A[i];
    }
    if(total <= p) {
        cout << -1 << endl;
        return 0;
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

int A[MAXN];
int B[MAXN];
int n;
int p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        if(B[i] <= time * A[i]) {
            total += (time * A[i] - B[i]) / p;
        }
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    ll total = 0;
    for(int i = 0; i < n; i++) {
        scanf("%d %d", &A[i], &B[i]);
        total += A[i];
    }
    if(total <= p) {
        cout << -1 << endl;
        return 0;
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

double A[MAXN];
double B[MAXN];
int n, p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += max(0.0, (time * A[i] - B[i]) / p);
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    for(int i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
    }
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += A[i];
    }
    if(total < p) {
        cout << -1 << endl;
        return 0;
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iostream>

typedef long long ll;

using namespace std;

const int MAXN = 100005;

int A[MAXN];
int B[MAXN];
int n;
ll p;

bool works(double time) {
    double total = 0;
    for(int i = 0; i < n; i++) {
        total += max(0.0, (time * A[i] - B[i]) / p);
    }
    return total < time;
}

int main() {
    cin >> n >> p;
    for(int i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
    }
    ll total = 0;
    for(int i = 0; i < n; i++) {
        total += A[i];
    }
    if(total < p) {
        cout << -1 << endl;
        return 0;
    }
    double low = 0;
    double high = 1e18;
    double epsilon = 1e-6;
    while(low + epsilon < high) {
        double mid = low + (high - low) * .5;
        if(works(mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    if(high == 1e18) {
        low = -1;
    }
    printf("%.8f\n", low);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p <= time)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e12;

	while(e-s > 0.000001) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e >= 1e12-eps) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p<time+eps)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e12;

	while(e-s > 0.000001) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e >= 1e12) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p <= time + eps)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	long long v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e12;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < -eps) {
			usage -= at;
		}
	}
	if(usage/p <= time + eps)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	long long v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e12;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p<time+eps)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e13;

	for (int i = 0; i < 1000; ++i) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e > 1e12) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p <= time)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e12;

	while(e-s > 0.000001) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e >= 1e12) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p < time)return 1;
	else return 0;
}

void gen() {

	printf("%.10lf\n",(9999999241.3125000000 + 9999999241.3125019073)/ 2);
	//=> 9999999241.3125
	printf("%d %d\n", 100000, 99999);
	for (int i = 0; i < 100000; ++i) {
		printf("%d %d\n", 1, 100000);
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	long long v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e10;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			//printf("%.10lf %.10lf %.10lf\n", s, m, e);
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < eps) {
			usage -= at;
		}
	}
	if(usage/p <= time + eps)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	long long v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e12;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p <= time)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	int v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e12;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p<time+eps)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e13;

	while(e-s > 1e-6) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e > 1e12) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p<time+eps)return 1;
	else return 0;
}

int main() {
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e15;

	while(fabs(e-s) > 1e-6) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e > 1e14) cout << -1 << endl;
	else cout << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage<=time*p)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e12;

	while(e-s > 0.000001) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e >= 1e12) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p <= time)return 1;
	else return 0;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	long long v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e12;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p < time)return 1;
	else return 0;
}

void gen() {

	printf("%.10lf\n",(9999999241.3125000000 + 9999999241.3125019073)/ 2);
	//=> 9999999241.3125
	printf("%d %d\n", 100000, 99999);
	for (int i = 0; i < 100000; ++i) {
		printf("%d %d\n", 1, 100000);
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> p;
	long long v = 0;
	for (int i = 0; i < n; ++i) {

		cin >> a[i] >> b[i];
		v+=a[i];
	}
	if(p >= v) {
		puts("-1");
		} else {
		double s = 0, e = 1e10;

		while(e-s > 0.000001) {
			double m = (e+s)/2;
			printf("%.10lf %.10lf %.10lf\n", s, m, e);
			if(ok(m)) {
				s = m;
			} else {
				e = m;
			}
		}
		cout << fixed << setprecision(9) << s << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100100;
const double eps = 1e-9;

int n, p;

int a[N], b[N];

int ok(double time) {
	double usage = 0;
	for (int i = 0; i < n; ++i) {
		double at = (double)b[i] - (double)a[i] * time;
		if(at < 0) {
			usage -= at;
		}
	}
	if(usage/p<time+eps)return 1;
	else return 0;
}

int main() {
	cin >> n >> p;

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}

	double s = 0, e = 1e13;

	while(e-s > 1e-6) {
		double m = (e+s)/2;
		if(ok(m)) {
			s = m;
		} else {
			e = m;
		}
	}
	if(e > 1e12) cout << -1 << endl;
	else cout << fixed << setprecision(9) << s << endl;
}


#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__V_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> Vi;
typedef pair<int,int> pii;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=100000+19;

int A[N],B[N];
int n,p;
ll sum;
db l,r;

bool check(db T){
	db tmp=0;
	For(i,1,n+1) tmp+=max(T*A[i]-B[i],0.0);
	return tmp<=T*p;
}

int main(){
	n=IN(),p=IN();
	For(i,1,n+1){
		A[i]=IN(),B[i]=IN();
		sum+=B[i];
	}
	if (sum<=p){
		puts("-1");
		return 0;
	}
	l=0,r=1e18;
	For(i,0,100){
		db mid=(l+r)/2.0;
		if (check(mid)) l=mid;else r=mid;
	}
	printf("%.10lf\n",l);
}


#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__V_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> Vi;
typedef pair<int,int> pii;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=100000+19;

int A[N],B[N];
int n,p;
ll sum;
db l,r;

bool check(db T){
	db tmp=0;
	For(i,1,n+1) tmp+=max(T*A[i]-B[i],0.0);
	return tmp<=T*p;
}

int main(){
	n=IN(),p=IN();
	For(i,1,n+1){
		A[i]=IN(),B[i]=IN();
		sum+=A[i];
	}
	if (sum<=p){
		puts("-1");
		return 0;
	}
	l=0,r=1e18;
	For(i,0,100){
		db mid=(l+r)/2.0;
		if (check(mid)) l=mid;else r=mid;
	}
	printf("%.10lf\n",l);
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define ep 1e-9
#define mos(a, b) (((a) - ep <= (b)) && ((b) <= (a) + ep))
#define koch(a, b) ((a) + ep < (b))
#define boz(a, b) ((a) - ep > (b))

const int maxx = 1e5 + 20;

int a[maxx], b[maxx], p, n;

bool ok(ld x)
{
	ld sum = 0.0;
	for(int i = 0; i < n; i++) sum += max((ld)0.0, 1.0 * x * a[i] - b[i]);
	return (!koch(1.0 * p * x, sum));
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> p;
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	ld l = 0.0, r = (long double)(2e18);
	for(int i = 0; i < 100; i++)
	{
		ld mid = l + (r - l) / 2;
		if (ok(mid))
			l = mid;
		else
			r = mid;
	}
	cout << setprecision(6) << fixed;
	if (l > (long double)(1e18)) cout << -1 << endl;
	else cout << l << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define ep 1e-9
#define mos(a, b) (((a) - ep <= (b)) && ((b) <= (a) + ep))
#define koch(a, b) ((a) + ep < (b))
#define boz(a, b) ((a) - ep > (b))

const int maxx = 1e5 + 20;

int a[maxx], b[maxx], p, n;

bool ok(ld x)
{
	ld sum = 0.0;
	for(int i = 0; i < n; i++) sum += max((ld)0.0, (1.0 * x * a[i] - b[i]) / p);
	return (x >= sum);
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> p;
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	ld l = 0.0, r = (long double)(2e18);
	for(int i = 0; i < 100; i++)
	{
		ld mid = l + (r - l) / 2;
		if (ok(mid))
			l = mid;
		else
			r = mid;
	}
	cout << setprecision(6) << fixed;
	if (l > (long double)(1e18)) cout << -1 << endl;
	else cout << l << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int maxx = 1e5 + 20;

int a[maxx], b[maxx], p, n;

bool ok(ld x)
{
	ld sum = 0.0;
	for(int i = 0; i < n; i++) sum += max((ld)0.0, 1.0 * x * a[i] - b[i]);
	return (p * x >= sum);
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> p;
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	ld l = 0.0, r = (long double)(1e14);
	while (r - l >= 0.0001)
	{
		ld mid = 1.0 * (l + r) / (2.0);
		if (ok(mid))
			l = mid;
		else
			r = mid;
	}
	cout << setprecision(6) << fixed;
	if (l == (long double)(1e14)) cout << -1 << endl;
	else cout << l << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int maxx = 1e5 + 20;

int a[maxx], b[maxx], p, n;

bool ok(ld x)
{
	ld sum = 0.0;
	for(int i = 0; i < n; i++) sum += max((ld)0.0, 1.0 * x * a[i] - b[i]);
	return (p * x >= sum);
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> p;
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	ld l = 0.0, r = (long double)(1e17);
	while (r - l >= 0.000001)
	{
		ld mid = 1.0 * (l + r) / (2.0);
		if (ok(mid))
			l = mid;
		else
			r = mid;
	}
	cout << setprecision(6) << fixed;
	if (l == (long double)(1e17)) cout << -1 << endl;
	else cout << l << endl;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int ans=oo, n, l, r, mid, xm, ym;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = x;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 100000;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			r = mid - 1, ans = min(ans, mid);
		else
			l = mid + 1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int ans=oo, n, l, r, mid, xm, ym;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = 0;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 100000;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			r = mid - 1, ans = min(ans, mid);
		else
			l = mid + 1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int n;
ll l, r, mid , xm , ym,ans=OO;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = 0;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 2000000001;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			r = mid - 1, ans = min(ans, mid);
		else
			l = mid + 1;
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int ans, n, l, r, mid, xm, ym;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = x;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 100000;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			l = mid + 1, ans = max(ans, mid);
		else
			r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int ans, n, l, r, mid, xm, ym;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = x;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 100000;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			r = mid - 1, ans = min(ans, mid);
		else
			l = mid + 1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int n;
ll l, r, mid , xm , ym,ans=OO;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = 0;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 2000000001;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			r = mid - 1, ans = min(ans, mid);
		else
			l = mid + 1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define pp  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)4e18;
const double PI = acos(-1.0);
const int N = (int)1e6 + 9;

//	v.resize(distance(v.begin(),unique(all(v))));

int ans, n, l, r, mid, xm, ym;
pair<int,int> a[100050];
bool check(int x)
{
	for (int i = 0; i < n; i++)
	{
		ym = x;
		if (a[i].first >= x)
		{
			ym -= (a[i].first - x);
		}
		else
		{

			ym += (x - a[i].first);
		}

		if (ym < a[i].second)
			return 0;
	}
	return 1;
}
int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	l = 1, r = 100000;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (check(mid))
			r = mid - 1, ans = max(ans, mid);
		else
			l = mid + 1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x[n],y[n],sum[n];
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i];
        sum[i]=x[i]+y[i];
    }
    int z=max(sum);
    cout<<z;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m=0;
    cin>>n;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
         m=max(m,a+b);
    }
    cout<<max<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x[n],y[n],sum[n];
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i];
        sum[i]=x[i]+y[i];
    }
    sort(sum,sum+n);
    cout<<sum[n];
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m=0;
    cin>>n;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
         m=max(m,x+y);
    }
    cout<<max<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m=0;
    cin>>n;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
         m=max(m,a+b);
    }
    cout<<m<<endl;
    return 0;
}


#include <iostream>
#include <cstdint>

int main()
{
    size_t n;
    std::cin >> n;
    uint64_t x, y;
    std::cin >> x >> y;
    uint64_t a = x + y;
    for (size_t i = 1; i < n; ++i) {
        std::cin >> x >> y;
        if (x + y > a)
            a = x + y;
    }
    std::cout << a;
}


#include <iostream>
#include <cstdint>

struct point
{
    uint64_t x;
    uint64_t y;
};

int main()
{
    size_t n;
    std::cin >> n;
    point p;
    std::cin >> p.x >> p.y;
    for (size_t i = 1; i < n; ++i) {
        point pi;
        std::cin >> pi.x >> pi.y;
        if (pi.x * pi.x + pi.y * pi.y > p.x * p.x + p.y * p.y)
            p = pi;
    }
    std::cout << p.x + p.y;
}


#include <iostream>
#include <cstdint>

struct point
{
    uint64_t x;
    uint64_t y;
};

int main()
{
    size_t n;
    std::cin >> n;
    point p;
    std::cin >> p.x >> p.y;
    for (size_t i = 1; i < n; ++i) {
        point pi;
        std::cin >> pi.x >> pi.y;
        if (pi.x * pi.y > p.x * p.y)
            p = pi;
    }
    std::cout << p.x + p.y;
}


#include <iostream>
#include <cstdint>

struct point
{
    uint64_t x;
    uint64_t y;
};

int main()
{
    size_t n;
    std::cin >> n;
    point p;
    std::cin >> p.x >> p.y;
    for (size_t i = 1; i < n; ++i) {
        point pi;
        std::cin >> pi.x >> pi.y;
        if (pi.x > p.x || pi.y > p.y)
            p = pi;
    }
    std::cout << p.x + p.y;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{long n,m=0; cin>>n;

for(long i=0;i<n;i++){cin>>a>>b; m=max(m,a+b);}

 cout<<m;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{long n; cin>>n;
pair<long,long>p[n];
for(long i=0;i<n;i++){cin>>p[i].first>>p[i].second;}
 sort(p,p+n);
 if(p[n-1].first==p[n-1].second){cout<<p[n-1].first*2;}else{cout<<p[n-1].first+p[n-1].second;}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{long n; cin>>n;
pair<long,long>p[n];
for(long i=0;i<n;i++){cin>>p[i].first>>p[i].second;}
 sort(p,p+n);
 if(p[n-1].first==p[n-1].second){cout<<p[n-1].first*2;}else{cout<<max(p[n-1].first,p[n-1].second)+1;}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{long n,m=0,a,b; cin>>n;

for(long i=0;i<n;i++){cin>>a>>b; m=max(m,a+b);}

 cout<<m;

    return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main (){
    int n;
    long long int  t[10000][2];
    cin >>n;
    long long i;
    long long x=0;
    for(i=0;i<n;i++)
    {
        cin >> t[i][0]>>t[i][1];
        if(t[i][0]+t[i][1]>x)
        {
            x=t[i][0]+t[i][1];
        }
    }
    cout << x;
    return 0;

}


#include <iostream>
#include <string>
using namespace std;
int main (){
    int n;
    long long int  t[10000];
    cin >>n;
    long long i;
    long long a,b;
    long long x=0;
    for(i=0;i<n;i++)
    {
        cin >> a>>b;
        t[i]=a+b;
    }
    for(i=0;i<n;i++)
    {
        if(t[i]>x)
        {
            x=t[i];
        }
    }
    cout <<x;
    return 0;

}


#include <iostream>
#include <string>
using namespace std;
int main (){
    int n;
    long long t[10000];
    cin >>n;
    long long i;
    long long a,b;
    long long x=0;
    for(i=0;i<n;i++)
    {
        cin >> a>>b;
        t[i]=a+b;
    }
    for(i=0;i<n;i++)
    {
        if(t[i]>x)
        {
            x=t[i];
        }
    }
    cout <<x;
    return 0;

}


#include <iostream>
#include <string>
using namespace std;
int main (){
    int n;
    long long int  t[10000][2];
    cin >>n;
    long long i;
    for(i=0;i<n;i++)
    {
        cin >> t[i][0]>>t[i][1];
    }
    long long x;
    x=0;
    for(i=0;i<n;i++)
    {
        if(t[i][0]+t[i][1]>x)
        {
            x=t[i][0]+t[i][1];
        }
    }
    cout << x;
    return 0;

}


#include <bits/stdc++.h>

using namespace std;
int main (){
    long long n;
    long long t[100000];
    cin >> n;
    long long i;
    long long a,b;
    long long x=0;
    for(i=0;i<n;i++)
    {
        cin >> a>>b;
        t[i]=a+b;
        if(t[i]>x)
        {
            x=t[i];
        }
    }
    cout <<x;
    return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,a,b;
	long double max=0;
	cin>>n;
	ll i;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		long double dis=sqrt(a*a+b*b);
		if(dis>max)
		max=a+b;
	}
	cout<<max<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if(a>=xmax && b>=ymax)
		{
			x1=a;
			x2=a;
			y1=b;y2=b;
		}
	}
	if((x1==x2)&&(y1==y2))
	cout<<2*x1<<endl;
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((t1<t2)?t1:t2)<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if(a>=xmax && b>=ymax)
		{
			x1=a;
			x2=a;
			y1=b;y2=b;
		}
	}
	if((x1==x2)&&(y1==y2))
	cout<<2*x1<<endl;
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((t1<=t2)?t1:t2)<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if((a==b))
		{
			if(a>=xmax && b>=ymax)
			{
				x1=a;
			x2=a;
			y1=b;y2=b;
			}
		}
	}
	if((x1==x2)&&(y1==y2))
	cout<<((x1<y1)?x1:y2)<<endl;
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((abs(t1)<=abs(t2))?abs(t1):abs(t2))<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,a,b;
	long double max=0;
	cin>>n;
	ll i;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		ll d=a+b;
		if(d>max)
		max=a+b;
	}
	cout<<max<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if((a==b))
		{
			if(a>=xmax && b>=ymax)
			{
				x1=a;
			x2=a;
			y1=b;y2=b;
			}
		}
	}
	if((x1==x2)&&(y1==y2))
	{
		cout<<x1+y1<<endl;
	}
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((abs(t1)<=abs(t2))?abs(t1):abs(t2))<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if(a>=xmax && b>=ymax)
		{
			x1=a;
			x2=a;
			y1=b;y2=b;
		}
	}
	if((x1==x2)&&(y1==y2))
	cout<<2*x1<<endl;
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((abs(t1)<=abs(t2))?abs(t1):abs(t2))<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if((a==b))
		{
			if(a>=xmax && b>=ymax)
			{
				x1=a;
			x2=a;
			y1=b;y2=b;
			}
		}
	}
	if((x1==x2)&&(y1==y2))
	{
		if(x1==y1)
		cout<<2*x1<<endl;
		else cout<<((x1<y1)?x1:y1)<<endl;
	}
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((abs(t1)<=abs(t2))?abs(t1):abs(t2))<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,a,b;
ll max=0;
	cin>>n;
	ll i;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		ll d=a+b;
		if(d>max)
		max=a+b;
	}
	cout<<max<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,i,xmax=0,ymax=0;
	cin>>n;
	ll a,b,x1,x2,y1,y2;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(xmax<a)
		{
			xmax=a;
			x1=a;y1=b;
		}
		if(ymax<b)
		{
			ymax=b;
			x2=a;y2=b;
		}
		if((a==b))
		{
			if(a>=xmax && b>=ymax)
			{
				x1=a;
			x2=a;
			y1=b;y2=b;
			}
		}
	}
	if((x1==x2)&&(y1==y2))
	cout<<2*x1<<endl;
	else
	{
		ll t1=((y1*(x2-x1))/(y1-y2))+x1;
		ll t2=((x1*(y2-y1))/(x1-x2))+y1;
		cout<<((abs(t1)<=abs(t2))?abs(t1):abs(t2))<<endl;
	}

}


//Purvil Mehta (purvilmehta06 - codeforces)
//DAIICT - GUJARAT - INDIA
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

int main()
{
	ll n,x,y,a,b;
	ll maxx=INT_MIN;
	ll maxy=INT_MIN;
	cin>>n;
	for(ll i=0;i<n;++i)
	{
		cin>>x>>y;
		if(maxx<x)
		{
			maxx=x;
			a=y;
		}
		if(maxy<y)
		{
			maxy=y;
			b=x;
		}
	}
	if(maxx<maxy)
		cout<<maxy+b;
	else
		cout<<maxx+a;

}


//Purvil Mehta (purvilmehta06 - codeforces)
//DAIICT - GUJARAT - INDIA
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

int main()
{
	ll n,x,y,a,b;
	ll maxx=INT_MIN;
	ll maxy=INT_MIN;
	cin>>n;
	for(ll i=0;i<n;++i)
	{
		cin>>x>>y;
		maxx=max(maxx,x+y);
	}
	cout<<maxx;

}


//Purvil Mehta (purvilmehta06 - codeforces)
//DAIICT - GUJARAT - INDIA
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

int main()
{
	ll n,x,y;
	ll maxx=INT_MIN;
	ll maxy=INT_MIN;
	cin>>n;
	for(ll i=0;i<n;++i)
	{
		cin>>x>>y;
		maxx = max(maxx,x);
		maxy = max(maxy,y);
	}
	cout<<max(maxx,maxy)+1;

}


//Purvil Mehta (purvilmehta06 - codeforces)
//DAIICT - GUJARAT - INDIA
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

int main()
{
	ll n,x,y;
	ll maxx=INT_MIN;
	ll maxy=INT_MIN;
	cin>>n;
	for(ll i=0;i<n;++i)
	{
		cin>>x>>y;
		maxx = max(maxx,x);
		maxy = max(maxy,y);
	}
	cout<<max(maxx,maxy);

}


#include<bits/stdc++.h>

using namespace std;
int main()
{
  int n;
  cin>>n;
  ll dis = 0;
  ll farx = 0;
  ll fary = 0;
  for(int i=0; i<=n-1; i++)
  {
    ll a,b;
    cin>>a>>b;
    ll tmp = a+b;
    if(tmp>dis)
    {
      dis = tmp;
      farx = a;
      fary = b;
    }
  }
  cout<<farx+fary;
  return 0;
  }


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  int n;
  cin>>n;
  ll dis = 0;
  for(int i=0; i<=n-1; i++)
  {
    ll a,b;
    cin>>a>>b;
    dis=max(dis,a+b);
  }
  cout<< dis;
  return 0;
  }


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  ll dis = 0;
  for(int i=0; i<=n-1; i++)
  {
    ll a,b;
    cin>>a>>b;
    dis=max(dis,a+b);
  }
  cout<< dis;
  return 0;
  }


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  int n;
  cin>>n;
  ll dis = 0;
  ll farx = 0;
  ll fary = 0;
  for(int i=0; i<=n-1; i++)
  {
    ll a,b;
    cin>>a>>b;
    ll tmp = a+b;
    if(tmp>dis)
    {
      dis = tmp;
      farx = a;
      fary = b;
    }
  }
  cout<<farx+fary;
  return 0;
  }


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mem(a, b) memset(a, b, sizeof(a))
const ll N = 1e5 + 10;
struct pos
{
    ll x, y;
} e[N];
bool cmp(pos a, pos b)
{
    return a.x < b.x;
}
int main()
{
    ll n, maxx = 0;
    scanf("%lld", &n);
    for (ll i = 1; i <= n; i++)
    {
        scanf("%lld%lld", &e[i].x, &e[i].y);
        maxx = max(maxx, e[i].x + e[i].y);
    }
    printf("%lld\n", maxx);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mem(a, b) memset(a, b, sizeof(a))
const ll N = 1e5 + 10;
struct pos
{
    ll x, y;
} e[N];
bool cmp(pos a, pos b)
{
    return a.x < b.x;
}
int main()
{
    ll n;
    scanf("%lld", &n);
    for (ll i = 1; i <= n; i++)
    {
        scanf("%lld%lld", &e[i].x, &e[i].y);
    }
    sort(e + 1, e + n + 1, cmp);
    ll maxy = 0, maxx = e[n].x, id = n;
    for (ll i = n; i >= 1; i--)
    {
        if (e[i].x != maxx)
        {
            break;
        }
        if (e[i].y > maxy)
        {
            maxy = e[i].y;
            id = i;
        }
    }
    printf("%lld\n", e[id].x + e[id].y);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mem(a, b) memset(a, b, sizeof(a))
int main()
{
    ll x = 0, y = 0, n, a, b;
    scanf("%lld", &n);
    for (ll i = 1; i <= n; i++)
    {
        scanf("%lld%lld", &a, &b);
        if (a > x || b > y)
        {
            x = a, y = b;
        }
    }
    ll k = x + y;
    // prllf("--%lld %lld %lld\n", x, y, k);
    printf("%lld\n", k);
    return 0;
}