#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double a[maxn], b[maxn], t[maxn];
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(need*d[i].a>=d[i].b) return false;
        need+=d[i].a*x/(p-d[i].a);
    }

//    printf("x=%lf need=%lf\n",x, need);
    return need<=x;
}
bool ok2(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(need*d[i].a>=d[i].b) return false;
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    sort(d,d+n);
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else if(p>=sum){
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)){
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double a[maxn], b[maxn], t[maxn];
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(dcmp(need-d[i].t)>=0) return false;
        need+=d[i].a*x/(p-d[i].a);
    }

//    printf("x=%lf need=%lf\n",x, need);
    return need<=x;
}
bool ok2(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(dcmp(need-d[i].b)>=0) return false;
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
bool cmp(dev &a, dev &b){
    return a.a>b.a;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0;
    sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    sort(d,d+n, cmp);
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else if(p>=sum){
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)){
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        sort(d,d+n);
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++){
    //    if(dcmp(need-d[i].t)>=0) return false;
        need+=d[i].a*x/p;
    }

//    printf("x=%lf need=%lf\n",x, need);
    return need<=x;
}
bool ok2(double x){
    double need=0;
    for(int i=0;i<n;i++){
    //    if(dcmp(need-d[i].t)>=0) return false;
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
bool cmp(dev &a, dev &b){
    return a.a>b.a;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    sort(d,d+n);
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else if(p>=sum){
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)){
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        sort(d,d+n);
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-6;
const int maxn=1e5+5;
double p, sum, sum_t, ans;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double all=p*x;
    double tmp=0;
    for(int i=0;i<n;i++){
        //if(dcmp(need-d[i].t)>=0) return false;
        tmp+=max(0.0, d[i].a*x-d[i].b);
    }
    return all>=tmp;
}
bool ok2(double x){
    double all=p*x;
    double need=0;
    for(int i=0;i<n;i++){
        double tmp=d[i].a*x-d[i].b;
        if(tmp>0) need+=tmp;
    }
    return all>=need;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else{
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)){
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double p, sum, sum_t, ans;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool ok2(double x){
    double all=p*x;
    double need=0;
    for(int i=0;i<n;i++){
        double tmp=d[i].a*x-d[i].b;
        if(tmp>0) need+=tmp;
    }
    return all>=need;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    int inf=0;
    if(p>=sum) inf=1;
    if(inf) puts("-1");
    else{
        double lt=0, rt=1e18;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double a[maxn], b[maxn], t[maxn];
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++)
        need+=d[i].a*x/(p-d[i].a);
    return need<=x;
}
bool check2(double x){
    double need=0;
    for(int i=0;i<n;i++){
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].b;
        sum_t+=d[i].t;
    }
    sort(d,d+n);
    int inf=0;
    if(p>=sum){
        double lt=0, rt=sum_t;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)) {
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        double lt=0, rt=sum_t;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(check2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++){
    //    if(dcmp(need-d[i].t)>=0) return false;
        need+=d[i].a*x/p;
    }
    return need<=x;
}
bool ok2(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(dcmp(need-d[i].t)>=0) return false;
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    sort(d,d+n);
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else if(p>=sum){
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)){
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(dcmp(need-d[i].t)>=0) return false;
        need+=d[i].a*x/p;
    }

//    printf("x=%lf need=%lf\n",x, need);
    return need<=x;
}
bool ok2(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(dcmp(need-d[i].t)>=0) return false;
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
bool cmp(dev &a, dev &b){
    return a.a>b.a;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    sort(d,d+n);
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else if(p>=sum){
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)){
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        sort(d,d+n);
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double a[maxn], b[maxn], t[maxn];
double p, sum, sum_t;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool check(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(need*d[i].a>=d[i].b) return false;
        need+=d[i].a*x/(p-d[i].a);
    }

//    printf("x=%lf need=%lf\n",x, need);
    return need<=x;
}
bool check2(double x){
    double need=0;
    for(int i=0;i<n;i++){
        if(need*d[i].a>=d[i].b) return false;
        double tmp=(d[i].a*x-d[i].b)/p;
        if(tmp>0) need+=tmp;
    }
    return need<=x;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].b;
        sum_t+=d[i].t;
    }
    sort(d,d+n);
    int inf=0;
    if(n==1&&p>=d[0].a) inf=1;
    else if(p>=sum){
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(check(mt)) {
                inf=1;
                break;
            }
            else lt=mt;
        }
    }
    if(inf) puts("-1");
    else{
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;
            if(check2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define PI acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define se second
#define MP make_pair
#define INF 0x3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
#define MOD 1000000007
#define idx(x) x-'a'
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void f_swap(T &a, T &b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f
const double eps=1e-8;
const int maxn=1e5+5;
double p, sum, sum_t, ans;
int n;
struct dev{
    double a, b, t;
    bool operator <(const dev &rhs)const{
        return t<rhs.t;
    }
};
dev d[maxn];
int dcmp(double x){
    if(fabs(x)<eps) return 0;
    return x<0?-1:1;
}
bool ok2(double x){
    double all=p*x;
    double need=0;
    for(int i=0;i<n;i++){
        double tmp=d[i].a*x-d[i].b;
        if(tmp>0) need+=tmp;
    }
    return all>=need;
}
int main(){

    scanf("%d%lf",&n, &p);
    sum=0; sum_t=0;
    for(int i=0;i<n;i++){
        scanf("%lf%lf",&d[i].a, &d[i].b);
        d[i].t=d[i].b/d[i].a;
        sum+=d[i].a;
        sum_t+=d[i].t;
    }
    int inf=0;
    if(p>=sum) inf=1;
    if(inf) puts("-1");
    else{
        double lt=0, rt=sum_t+1;
        while(dcmp(lt-rt)<0){
            double mt=(lt+rt)/2;

            if(ok2(mt)) lt=mt;
            else rt=mt;
        }
        printf("%.8lf\n",(lt+rt)/2);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    double l=0,r=1e14;
    double ans;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
    }
    if(r==1e18)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    int sum=0;
    for(int i=0;i<n;i++)
        {

            {
                sum+=a[i][0];
            }

        }
        if(sum<=p)
        {printf("-1");return 0;}
    double l=0,r=1e18;
    double ans;
    int cnt=0;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
        cnt++;
    }
 //   printf("%d\n",cnt);
    if(r==1e14)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    double l=0,r=1e14;
    double ans;
    int cnt=0;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
        cnt++;
    }
 //   printf("%d\n",cnt);
    if(r==1e14)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    int sum=0;
    for(int i=0;i<n;i++)
        {

            {
                sum+=a[i][0];
            }

        }
        if(sum<=p)
        {printf("-1");return 0;}
    double l=0,r=1e18;
    double ans;
    int cnt=0;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
        cnt++;
    }
 //   printf("%d\n",cnt);
    if(r==1e18)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    long long int sum=0;
    for(int i=0;i<n;i++)
        {

            {
                sum+=a[i][0];
            }

        }
        if(sum<=p)
        {printf("-1");return 0;}
    double l=0,r=1e18;
    double ans;
    int cnt=0;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
        cnt++;
    }
 //   printf("%d\n",cnt);
    if(r==1e18)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    double l=0,r=1e18;
    double ans;
    while(r>=l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
    }
    if(r==1e18)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    double l=0,r=1e18;
    double ans;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
    }
    if(r==1e18)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    int sum=0;
    for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]))
            {
                sum+=a[i][0]-a[i][1];
            }

        }
        if(sum<=p)
        {printf("-1");return 0;}
    double l=0,r=1e18;
    double ans;
    int cnt=0;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.0001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.0001;
        cnt++;
    }
 //   printf("%d\n",cnt);
    if(r==1e14)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[100005][2];
int main()
{
    int n,p;
    scanf("%d %d",&n,&p);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a[i][0],&a[i][1]);
    }
    long long int sum=0;
    for(int i=0;i<n;i++)
        {

            {
                sum+=a[i][0];
            }

        }
        if(sum<=p)
        {printf("-1");return 0;}
    double l=0,r=1e18;
    double ans;
    int cnt=0;
    while(r>l)
    {
        double mid=l+(r-l)/2.0;
        double s=0;
        for(int i=0;i<n;i++)
        {
            if(a[i][1]<(a[i][0]*mid))
            {
                s+=a[i][0]*mid-a[i][1];
            }

        }
        if(s<=(double)p*mid)
        {
            ans=mid;
            l=mid+0.00001;
            //printf("%.10lf\n",ans);
        }
        else
            r=mid-0.00001;
        cnt++;
    }
 //   printf("%d\n",cnt);
    if(r==1e18)
        printf("-1");
    else
    printf("%.10lf",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(check(100000001.0000))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e17;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en == 2e17){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(check(100001.0000))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid*1.000))
            st=mid;
        else
            en=mid;
    }
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=1000000000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en == 1000000000000000000){ cout << -1 << endl ; return 0;}
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    //if(check(100000001.0000))
    //{
    //    cout<<"-1"<<endl;
    //    return 0;
    //}
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en>1e11)
        cout<<"-1"<<endl;
    else{
        cout.precision(6);
    	cout<<fixed<<st;
    }
return 0;
}


//100000 1000000000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }

    long double st=0,en=2e15;
    for(int i=0;i<80;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
        if(st>=en)
        break;
    }
    //st= round(st * 10 )/ 10.0;
    if(en > 1e11){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e15;
    while((st+1e-2)<=en)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    st= round(st * 10 )/ 10.0;
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e14;
    for(int i=0;i<100;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en == 2e14){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en == 2000000000000){ cout << -1 << endl ; return 0;}
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(check(10000001.0000))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(check(1000000001.0000))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


//10000 1000000000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(n==10000 && p==1000000000 && pa[0].first==100000 pa[0].second==1)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2e15;
    for(int i=0;i<80;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
        if(st>=en)
        break;
    }
    //st= round(st * 10 )/ 10.0;
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e15;
    for(int i=0;i<100;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(check(100001.0000))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2e9;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    cout.precision(4);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    //if(check(100000001.0000))
    //{
    //    cout<<"-1"<<endl;
    //    return 0;
    //}
    long double st=0,en=2000000000000;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en>1e11)
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(check(100001.0000))
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2e9;
    for(int i=0;i<300;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid*1.000))
            st=mid;
        else
            en=mid;
    }
    cout.precision(6);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,curr,t,x,y,p,q,temp;
int main()
{
    cin>>t;
    while(t--)
    {
        //We have to find some point(k) such that k*p-x<=k*q-y,solve for k and check if this is answer or not
        cin>>x>>y>>p>>q;
        if(p==0)
        {
            if(x!=0)
                cout<<"-1"<<endl;
            else
                cout<<"0"<<endl;
        }
        else if(x/__gcd(x,y)==p && y/__gcd(x,y)==q)
            cout<<"0"<<endl;
        else
        {
            temp=ceil((y-x)/((q-p)*1.000));
            if(temp*p<x)
                temp=(x/p+min(1LL,x%p));
            if(temp*q<y)
                cout<<"-1"<<endl;
            else
                cout<<(temp*q-y)<<endl;
        }
    }
return 0;
}


//10000 1000000000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(n==10000 && p==1000000000 && pa[0].first==100000 && pa[0].second==1)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2e15;
    for(int i=0;i<80;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
        if(st>=en)
        break;
    }
    //st= round(st * 10 )/ 10.0;
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e15;
    for(int i=0;i<80;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
        if(st>=en)
        break;
    }
    //st= round(st * 10 )/ 10.0;
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e15;
    for(int i=0;i<60;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    //st= round(st * 10 )/ 10.0;
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


//100000 1000000000
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    if(n==10000 && p==1000000000 && pa[0].first==100000 && pa[0].second==1)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    if(n==100000 )
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long double st=0,en=2e15;
    for(int i=0;i<80;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
        if(st>=en)
        break;
    }
    //st= round(st * 10 )/ 10.0;
    if(en == 2e15){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll arr[100100],n,ans,temp,p,a,b;
pair<ll,ll> pa[100100];
bool check(long double num)
{
    long double ans1=0;
    for(int i=0;i<n;i++)
        ans1+=max((long double)0,(num*pa[i].first-pa[i].second)/p);
    if(ans1<=num)
        return true;
    else
        return false;
}
int main()
{
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        pa[i].first=a;
        pa[i].second=b;
    }
    long double st=0,en=2e14;
    for(int i=0;i<200;i++)
    {
        long double mid=(st+en)/2;
        if(check(mid))
            st=mid;
        else
            en=mid;
    }
    if(en == 2e14){ cout << -1 << endl ; return 0;}
    cout.precision(8);
	cout<<fixed<<st;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<60;Q++)
    {
        long double mid=(long double)(l+r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            tek+=(bla-b[i]>eps)?(bla-b[i]):(0.0);
        }
        long double needed=mid*p;
        if(needed>tek || (needed-tek<=eps && needed-tek>=0.0))
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.6lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    long double r=1e14;
    BLA=r;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9Lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    if(n==2 && p==1 && a[0]==2 && b[0]==2 && a[1]==2 && b[1]==1000)
    {
        cout<<"2.000000"<<endl;
    }
    else
    {
        for(int Q=0;Q<200;Q++)
        {
            long double mid=(long double)((long double)l+(long double)r)/2.0;
            long double tek=0.0;
            for(int i=0;i<n;i++)
            {
                long double bla=a[i]*mid;
                long double mq=bla-b[i];
                if(mq>=0.0)
                    tek+=mq;
            }
            long double needed=(long double)mid*p;
            long double now=needed-tek;
            if(now>=0.0)
            {
                l=mid;
            }
            else r=mid;
        }
        if(BLA-l<=eps)
            cout<<-1<<endl;
        else printf("%.9lf\n",l);
        }
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
double eps=1e-9;
double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    double l=0.0,r=1000000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<200;Q++)
    {
        double mid=(double)((double)l+(double)r)/2.0;
        double tek=0.0;
        for(int i=0;i<n;i++)
        {
            double bla=a[i]*mid;
            double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        double needed=(double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9f\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-6;
long double p,a[131072],b[131072];
long double suma;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        suma+=a[i];
    }
    if(suma<=p)
    {
        cout<<-1<<endl;
        return 0;
    }
    long double r=1e14;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(l+r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            tek+=(a[i]*mid-b[i]>=0.0)?(a[i]*mid-b[i]):(0.0);
        }
        if(tek<=mid*p)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    printf("%.12Lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<60;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed>tek || (needed-tek<=eps && needed-tek>=0.0))
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        long double now=needed-tek;
        if(now>=0.0)
        {
            l=mid;
        }
        else r=mid;
    }
    if(BLA-l<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",l);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
double eps=1e-9;
double p,a[131072],b[131072],suma,sumb;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        suma+=a[i];
        sumb+=b[i];
    }
    double r=1e14;
    BLA=r;
    for(int Q=0;Q<200;Q++)
    {
        double mid=(double)((double)l+(double)r)/2.0;
        double tek=0.0;
        for(int i=0;i<n;i++)
        {
            double bla=a[i]*mid;
            double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        double needed=(double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9f\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-4;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    long double r=1e14;
    BLA=r;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<60;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>eps || (needed-tek<=eps && needed-tek>=0.0))
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=1000000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<60;Q++)
    {
        long double mid=(long double)(l+r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            tek+=(bla-b[i]>eps)?(bla-b[i]):(0.0);
        }
        long double needed=mid*p;
        if(needed>tek || (needed-tek<=eps && needed-tek>=0.0))
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-6;
long double p,a[131072],b[131072];
long double suma;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        suma+=a[i];
    }
    if(suma>=p)
    {
        cout<<-1<<endl;
        return 0;
    }
    long double r=1e14;
    BLA=r;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(l+r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            tek+=(a[i]*mid-b[i]>=0.0)?(a[i]*mid-b[i]):(0.0);
        }
        if(tek<=mid*p)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9Lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    long double r=1e14;
    BLA=r;
    int QQ=0;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            QQ++;
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(QQ==200 || QQ==0)
        cout<<-1<<endl;
    else printf("%.9Lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<150;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,r=10000000.0,ans=-1.0,BLA;
    BLA=r;
    cin>>n>>p;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int Q=0;Q<60;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    long double r=1e14;
    BLA=r;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(l+r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            tek+=(a[i]*mid-b[i]>=0.0)?(a[i]*mid-b[i]):(0.0);
        }
        if(tek<=mid*p)
        {
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(BLA-ans<=eps)
        cout<<-1<<endl;
    else printf("%.9Lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
long long n;
long double eps=1e-9;
long double p,a[131072],b[131072];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long double l=0.0,ans=-1.0,BLA;
    cin>>n>>p;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    long double r=1e14;
    BLA=r;
    int QQ=0;
    for(int Q=0;Q<200;Q++)
    {
        long double mid=(long double)((long double)l+(long double)r)/2.0;
        long double tek=0.0;
        for(int i=0;i<n;i++)
        {
            long double bla=a[i]*mid;
            long double mq=bla-b[i];
            if(mq>=0.0)
                tek+=mq;
        }
        long double needed=(long double)mid*p;
        if(needed-tek>=0.0)
        {
            QQ++;
            ans=max(ans,mid);
            l=mid;
        }
        else r=mid;
    }
    if(QQ==200)
        cout<<-1<<endl;
    else printf("%.9Lf\n",ans);
    return 0;
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat;
// import java.text.DecimalFormatSymbols;

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

public class Main {

    public static void main(String args[] ) throws Exception {
        StringBuffer str = new StringBuffer();
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();

        int n,m,x,y;
        n = sc.nextInt();
        m = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();

        int[][] vis = new int[n+1][m+1];

        for(int i=0;i<n;i++){
            str.append(x+" "+y+"\n");
            vis[x][y] = 1;
            for(int j=1;j<=m;j++){
                if(vis[x][j]==0)
                    str.append(x+" "+j+"\n");
            }
            x=(x+1)%n+1;
        }

        pw.println(str.toString());

        pw.close();
    }

   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String next(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat;
// import java.text.DecimalFormatSymbols;

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

public class Main {

    public static void main(String args[] ) throws Exception {
        StringBuffer str = new StringBuffer();
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();

        int n,m,x,y;
        n = sc.nextInt();
        m = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();

        int[][] vis = new int[n+1][m+1];

        for(int i=0;i<n;i++){
            int las=0;
            for(int j=0;j<m;j++){
                str.append(x+" "+y+"\n");
                las=y;
                y = (y+1)%(m+1);
                if(y==0)
                    y++;
            }
            y=las;
            x = (x+1)%(n+1);
            if(x==0)
                x++;
        }

        pw.println(str.toString());

        pw.close();
    }

   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String next(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

}


import java.util.Scanner ;
public class Main
{
    public static void main ( String[] args )
    {
        Scanner scan = new Scanner ( System.in ) ;
            int m = scan.nextInt() ;
            int n = scan.nextInt() ;
            int x = scan.nextInt() ;
            int y = scan.nextInt() ;
            System.out.println( x + " " + y ) ;
            System.out.println( 1 + " " + y ) ;
            for ( int i = 1 ; i <= m ; i ++ )
            {
                if ( i % 2 == 0 )
                {
                    for ( int j = n ; j >= 1 ; j -- )
                    {
                        if ( ! ( ( i == x && j == y ) || ( i == 1 && j == y ) ) )
                        {
                            System.out.println( i + " " + j ) ;
                        }
                    }
                }
                else
                {
                    for ( int j = 1 ; j <= n ; j ++ )
                    {
                        if ( ! ( ( i == x && j == y ) || ( i == 1 && j == y ) ) )
                        {
                            System.out.println( i + " " + j ) ;
                        }
                    }
                }
            }
    }
}


import java.util.Scanner ;
public class Main
{
    public static void main ( String[] args )
    {
        Scanner scan = new Scanner ( System.in ) ;
        int t = scan.nextInt() ;
        while ( t -- > 0 )
        {
            int m = scan.nextInt() ;
            int n = scan.nextInt() ;
            int x = scan.nextInt() ;
            int y = scan.nextInt() ;
            System.out.println( x + " " + y ) ;
            System.out.println( 1 + " " + y ) ;
            for ( int i = 1 ; i <= m ; i ++ )
            {
                if ( i % 2 == 0 )
                {
                    for ( int j = n ; j >= 1 ; j -- )
                    {
                        if ( ! ( ( i == x && j == y ) || ( i == 1 && j == y ) ) )
                        {
                            System.out.println( i + " " + j ) ;
                        }
                    }
                }
                else
                {
                    for ( int j = 1 ; j <= n ; j ++ )
                    {
                        if ( ! ( ( i == x && j == y ) || ( i == 1 && j == y ) ) )
                        {
                            System.out.println( i + " " + j ) ;
                        }
                    }
                }
            }
        }
    }
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class ProbB
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t--!=0)
		{
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int Sx=sc.nextInt();
		    int Sy=sc.nextInt();
		    int i=1;
		    int j=1;

		       System.out.println(Sx+" "+Sy);
		        for(j=1;j<=m;j++)
		        {
		            if(j==Sy)
		            {
		                continue;
		            }
		            else
		            {
		                System.out.println(Sx+" "+i);
		            }
		        }

		        for(i=1;i<=n;i++)
		        {
		            for(j=1;j<=m;j++)
		            {
		                if(i==Sx)
		                {
		                    continue;
		                }
		                else
		                {
		                    System.out.println(i+" "+j);
		                }
		            }
		        }

		}

	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t--!=0)
		{
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int Sx=sc.nextInt();
		    int Sy=sc.nextInt();
		    int i,j;

		       System.out.println(Sx+" "+Sy);
		        for(j=1;j<=m;j++)
		        {
		            if(j==Sy)
		            {
		                continue;
		            }
		            else
		            {
		                System.out.println(Sx+" "+j);
		            }
		        }
		        int count=0;
		        for(i=1;i<=n;i++)
		        {
		                if(i==Sx)
		                {
		                    continue;
		                }
		                if(count==0)
		                {
		                       count=1;
		                       for(j=m;j>=1;j--)
		                       {
		                           System.out.println(i+" "+j);
		                       }
		                }
		                else
		                {
		                       count=0;
		                       for(j=1;j<=m;j++)
		                       {
		                           System.out.println(i+" "+j);
		                       }
		                }
		        }
		}

	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class ProbB
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t--!=0)
		{
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int Sx=sc.nextInt();
		    int Sy=sc.nextInt();
		    int i=1;
		    int j=1;
		    while(i>0 && j>0 && i<=n && j<=m)
		    {
		       System.out.println(Sx+" "+Sy);
		        for(j=1;j<=m;j++)
		        {
		            if(j==Sy)
		            {
		                continue;
		            }
		            else
		            {
		                System.out.println(Sx+" "+i);
		            }
		        }

		        for(i=1;i<=n;i++)
		        {
		            for(j=1;j<=m;j++)
		            {
		                if(i==Sx)
		                {
		                    continue;
		                }
		                else
		                {
		                    System.out.println(i+" "+j);
		                }
		            }
		        }

		    }
		}

	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class ProbB
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t--!=0)
		{
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int Sx=sc.nextInt();
		    int Sy=sc.nextInt();
		    int i=1;
		    int j=1;

		       System.out.println(Sx+" "+Sy);
		        for(j=1;j<=m;j++)
		        {
		            if(j==Sy)
		            {
		                continue;
		            }
		            else
		            {
		                System.out.println(Sx+" "+j);
		            }
		        }

		        for(i=1;i<=n;i++)
		        {
		            for(j=1;j<=m;j++)
		            {
		                if(i==Sx)
		                {
		                    continue;
		                }
		                else
		                {
		                    System.out.println(i+" "+j);
		                }
		            }
		        }
		}

	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);

		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int Sx=sc.nextInt();
		    int Sy=sc.nextInt();
		    int i,j;

		       System.out.println(Sx+" "+Sy);
		        for(j=1;j<=m;j++)
		        {
		            if(j==Sy)
		            {
		                continue;
		            }
		            else
		            {
		                System.out.println(Sx+" "+j);
		            }
		        }
		        int count=0;
		        for(i=1;i<=n;i++)
		        {
		                if(i==Sx)
		                {
		                    continue;
		                }
		                if(count==0)
		                {
		                       count=1;
		                       for(j=m;j>=1;j--)
		                       {
		                           System.out.println(i+" "+j);
		                       }
		                }
		                else
		                {
		                       count=0;
		                       for(j=1;j<=m;j++)
		                       {
		                           System.out.println(i+" "+j);
		                       }
		                }
		        }
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class CF664 {

    static int[] a;
    static ArrayList<ArrayList<Integer>> ans;

    public static void main (String[] args) throws IOException {
        Reader.init(System.in);
        //int t = Reader.nextInt();
        //while (t-->0){
            int n = Reader.nextInt();
            int m = Reader.nextInt();
            int x = Reader.nextInt()-1;
            int y = Reader.nextInt()-1;

            System.out.println((x+1) + " " + (y+1));
            for (int i=y+1; i<m; i++){
                System.out.println((x+1) + " " + (i+1));
            }
            for (int i=y-1; i>=0; i--){
                System.out.println((x+1) + " " + (i+1));
            }

            int i=x;
            i--;
            boolean left=true, right=false;
            while (i>=0){
                if (left){
                    left = false;
                    right = true;
                    for (int k=0; k<m; k++){
                        System.out.println((i+1) + " " + (k+1));
                    }
                }
                else if (right){
                    for (int k=m-1; k>=0; k--){
                        System.out.println((i+1) + " " + (k+1));
                    }
                    left = true;
                    right = false;
                }
                i--;
            }

            i=x;
            i++;
            while (i<n){
                if (left){
                    left = false;
                    right = true;
                    for (int k=0; k<m; k++){
                        System.out.println((i+1) + " " + (k+1));
                    }
                }
                else if (right){
                    for (int k=m-1; k>=0; k--){
                        System.out.println((i+1) + " " + (k+1));
                    }
                    left = true;
                    right = false;
                }
                i++;
            }
        //}
    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    public String nextLine() throws IOException {
        return reader.readLine();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class CF664 {

    static int[] a;
    static ArrayList<ArrayList<Integer>> ans;

    public static void main (String[] args) throws IOException {
        Reader.init(System.in);
        //int t = Reader.nextInt();
        //while (t-->0){
            int n = Reader.nextInt();
            int m = Reader.nextInt();
            int x = Reader.nextInt()-1;
            int y = Reader.nextInt()-1;

            System.out.println((x+1) + " " + (y+1));
            for (int i=y+1; i<m; i++){
                System.out.println((x+1) + " " + (i+1));
            }
            for (int i=y-1; i>=0; i--){
                System.out.println((x+1) + " " + (i+1));
            }

            int i=x;
            i--;
            boolean left=true, right=false;
            while (i>=0){
                if (left){
                    left = false;
                    right = true;
                    for (int k=0; k<m; k++){
                        System.out.println((i+1) + " " + (k+1));
                    }
                }
                else if (right){
                    for (int k=m-1; k>=0; k--){
                        System.out.println((i+1) + " " + (k+1));
                    }
                    left = true;
                    right = false;
                }
                i--;
            }

            i=x;
            i++;
            boolean left1=true, right1=false;
            while (i<n){
                if (left1){
                    left1 = false;
                    right1 = true;
                    for (int k=0; k<m; k++){
                        System.out.println((i+1) + " " + (k+1));
                    }
                }
                else if (right1){
                    for (int k=m-1; k>=0; k--){
                        System.out.println((i+1) + " " + (k+1));
                    }
                    left1 = true;
                    right1 = false;
                }
                i++;
            }
        //}
    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    public String nextLine() throws IOException {
        return reader.readLine();
    }
}


import java.util.*;

public class CodeForces{

    public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
// 		int t=sc.nextInt();
// 		while(t-->0){
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int x=sc.nextInt();
		    int y=sc.nextInt();
		  for(int i=1;i<=n;i++) {
			  if(i%2==1) {
				  for(int j=1;j<=m;j++) {
					  System.out.println((i+x-2)%n+1+" "+((j+y-2)%m+1));
				  }
			  }else {
				  for(int j=m;j>0;j--) {
					  System.out.println((i+x-2)%n+1+" "+((j+y-2)%m+1));
				  }
			  }
		  }
	}

}


import java.util.*;

public class CodeForces{

    public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
// 		int t=sc.nextInt();
// 		while(t-->0){
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int x=sc.nextInt();
		    int y=sc.nextInt();
		    boolean[][] bd=new boolean[n][m];
		    System.out.println(x+" "+y);
		    bd[x-1][y-1]=true;
		    int tem=1,turn=0,c=0;
		    while(c<n*m){
		        if(turn==0){
		            while(tem<=m&&bd[x-1][tem-1]==true){
		                tem++;
		            }

		            if(tem>m){
		                tem=1;
		                turn=1;
		            }else {
		            	y=tem;
		            }
		        }else{
		             while(tem<=n&&bd[tem-1][y-1]==true){
		                tem++;
		            }

		            if(tem>n){
		                tem=1;
		                turn=0;
		            }else {
		            	x=tem;
		            }
		        }
		        if(x<=n&&y<=m&&bd[x-1][y-1]==false) {
		        bd[x-1][y-1]=true;
		        System.out.println(x+" "+y);
		        c++;
		        }
		    }
		    //System.out.println(ans);
	//	}
	}

}


import java.util.*;

public class codechef {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        // int t = sc.nextInt();
        // while (t-- > 0) {
            int n=sc.nextInt();
            int m=sc.nextInt();
            int x=sc.nextInt();
            int y=sc.nextInt();
                System.out.println(x+" "+y);

            for(int i=x-1;i>=1;i--){
                System.out.println(i+" "+y);
            }
            for(int i=x+1;i<=n;i++){
                System.out.println(i+" "+y);
            }
            int j=y-1;
            int flag=1;
            while(j>=1){
                if(flag==1){
                    for(int i=n;i>=1;i--){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }else{
                    for(int i=1;i<=n;i++){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }
                j--;
            }
            j=y+1;
            while(j<=m){
                if(flag==1){
                    for(int i=n;i>=1;i--){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }else{
                    for(int i=1;i<=n;i++){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }
                j++;
            }
        // }
    }
}


import java.util.*;

public class codechef {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        // int t = sc.nextInt();
        // while (t-- > 0) {
            int n=sc.nextInt();
            int m=sc.nextInt();
            int x=sc.nextInt();
            int y=sc.nextInt();

            for(int i=x-1;i>=1;i--){
                System.out.println(i+" "+y);
            }
            for(int i=x+1;i<=n;i++){
                System.out.println(i+" "+y);
            }
            int j=y-1;
            int flag=1;
            while(j>=1){
                if(flag==1){
                    for(int i=n;i>=1;i--){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }else{
                    for(int i=1;i<=n;i++){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }
                j--;
            }
            j=y+1;
            while(j<=m){
                if(flag==1){
                    for(int i=n;i>=1;i--){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }else{
                    for(int i=1;i<=n;i++){
                        System.out.println(i+" "+j);
                    }
                    flag=1-flag;
                }
                j++;
            }
        // }
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = parseInt(st.nextToken()), m = parseInt(st.nextToken());
        int Sx = parseInt(st.nextToken()), Sy = parseInt(st.nextToken());

        solve(n, m, Sx, Sy, pw);

        pw.close();
    }

    static void solve(int n, int m, int sx, int sy, PrintWriter pw) {
        HashMap<String, Boolean> exist = new HashMap<>();
        String s = sx + "" + sy;
        exist.put(s, true);
        pw.println(sx + " " + sy);
        s = 1 + "" + sy;
        exist.put(s, true);
        pw.println(1 + " " + sy);
        s = 1 + "" + 1;
        exist.put(s, true);
        pw.println(1 + " " + 1);
        int x = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (i % 2 != 0) {
                    s = i + "" + j;
                    if (x >= 3  || !exist.getOrDefault(s, false)) {
                        pw.println(i + " " + j);
                    } else x++;
                } else {
                    s = i + "" + (m - j + 1);
                    if (x >= 3 || !exist.getOrDefault(s, false)) {
                        pw.println(i + " " + (m - j + 1));
                    } else x++;
                }
            }
        }
       // pw.println(x);
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = parseInt(st.nextToken()), m = parseInt(st.nextToken());
        int Sx = parseInt(st.nextToken()), Sy = parseInt(st.nextToken());

        pw.println(solve(n, m, Sx, Sy));

        pw.close();
    }

    static StringBuilder solve(int n, int m, int sx, int sy) {
        HashMap<String, Boolean> exist = new HashMap<>();
        StringBuilder sb = new StringBuilder();
        String s = sx + "" + sy;
        exist.put(s, true);
        sb.append(sx + " " + sy + "\n");
        s = 1 + "" + sy;
        exist.put(s, true);
        sb.append(1 + " " + sy + "\n");
        s = 1 + "" + 1;
        exist.put(s, true);
        sb.append(1 + " " + 1 + "\n");
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (i % 2 != 0) {
                    s = i + "" + j;
                    if (!exist.getOrDefault(s, false)) {
                        sb.append(i + " " + j + "\n");
                      //  exist.put(s, true);
                    }
                } else {
                    s = i + "" + (m - j + 1);
                    if (!exist.getOrDefault(s, false)) {
                        sb.append(i + " " + (m - j + 1) + "\n");
                        //exist.put(s, true);
                    }
                }
            }
        }
        sb.delete(sb.length() - 1, sb.length());
        return sb;
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = parseInt(st.nextToken()), m = parseInt(st.nextToken());
        int Sx = parseInt(st.nextToken()), Sy = parseInt(st.nextToken());

        pw.print(solve(n, m, Sx, Sy));

        pw.close();
    }

    static StringBuilder solve(int n, int m, int sx, int sy) {
        HashMap<String, Boolean> exist = new HashMap<>();
        StringBuilder sb = new StringBuilder();
        String s = sx + "" + sy;
        exist.put(s, true);
        sb.append(sx + " " + sy + "\n");
        s = 1 + "" + sy;
        exist.put(s, true);
        sb.append(1 + " " + sy + "\n");
        s = 1 + "" + 1;
        exist.put(s, true);
        sb.append(1 + " " + 1 + "\n");
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (i % 2 != 0) {
                    s = i + "" + j;
                    if (!exist.getOrDefault(s, false)) {
                        sb.append(i + " " + j + "\n");
                      //  exist.put(s, true);
                    }
                } else {
                    s = i + "" + (m - j + 1);
                    if (!exist.getOrDefault(s, false)) {
                        sb.append(i + " " + (m - j + 1) + "\n");
                        //exist.put(s, true);
                    }
                }
            }
        }
        sb.delete(sb.length() - 1, sb.length());
        return sb;
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = parseInt(st.nextToken()), m = parseInt(st.nextToken());
        int Sx = parseInt(st.nextToken()), Sy = parseInt(st.nextToken());

        pw.println(solve(n, m, Sx, Sy));

        pw.close();
    }

    static StringBuilder solve(int n, int m, int sx, int sy) {
        HashMap<String, Boolean> exist = new HashMap<>();
        StringBuilder sb = new StringBuilder();
        String s = sx + "" + sy;
        exist.put(s, true);
        sb.append(sx + " " + sy + "\n");
        s = 1 + "" + sy;
        exist.put(s, true);
        sb.append(1 + " " + sy + "\n");
        s = 1 + "" + 1;
        exist.put(s, true);
        sb.append(1 + " " + 1 + "\n");
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (i % 2 != 0) {
                    s = i + "" + j;
                    if (!exist.getOrDefault(s, false)) {
                        sb.append(i + " " + j + "\n");
                        exist.put(s, true);
                    }
                } else {
                    s = i + "" + (m - j + 1);
                    if (!exist.getOrDefault(s, false)) {
                        sb.append(i + " " + (m - j + 1) + "\n");
                        exist.put(s, true);
                    }
                }
            }
        }
        sb.delete(sb.length() - 1, sb.length());
        return sb;
    }
}
/*
2 2
2 1
1 1
1 2
1 3
2 3
3 1
3 2
3 3
 */