Problem: Recently the construction of Berland collider has been completed. Collider can be represented as a long narrow tunnel that contains n particles. We associate with collider 1-dimensional coordinate system, going from left to right. For each particle we know its coordinate and velocity at the moment of start of the collider. The velocities of the particles don't change after the launch of the collider. Berland scientists think that the big bang will happen at the first collision of particles, whose velocities differs in directions. Help them to determine how much time elapses after the launch of the collider before the big bang happens.

Input

The first line contains single integer n (1 ≤ n ≤ 5·105) — amount of particles in the collider. Next n lines contain description of particles. Each particle is described by two integers xi, vi ( - 109 ≤ xi, vi ≤ 109, vi ≠ 0) — coordinate and velocity respectively. All the coordinates are distinct. The particles are listed in order of increasing of coordinates. All the coordinates are in meters, and all the velocities — in meters per second. The negative velocity means that after the start of collider the particle will move to the left, and the positive — that the particle will move to the right.

Output

If there will be no big bang, output -1. Otherwise output one number — how much time in seconds elapses after the launch of the collider before the big bang happens. Your answer must have a relative or absolute error less than 10 - 9.

Examples

Input

3
-5 9
0 1
5 -1


Output

1.00000000000000000000


Input

6
1 3
2 3
3 3
4 -3
5 -1
6 -100


Output

0.02912621359223301065

Solution (in JAVA):

Solution:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class E {

    public long[] pre;
    public long[][] dp;
    public int b;

    void solve() {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        P[] data = new P[n];
        int pos = 0;
        int nev = 0;
        for (int i = 0; i < n; i++) {
            data[i] = new P(in.nextInt(), in.nextInt());
            if (data[i].v < 0 && pos != 0) {
                nev++;
            } else if(data[i].v > 0) {
                pos++;
            }
        }
        if (nev == 0 || pos == 0) {
            out.println(-1);
        } else {
           
            double start = 0;
            double end = 2e9;
            int count = 100;
            boolean once = false;
            while (count-- > 0) {
                double mid = (start + end) / 2;
                //   System.out.println(end - start);
                boolean cross = false;
                double max = -2e9;
                for(int i = 0; i < n; i++){
                    if(data[i].v > 0){
                        max = Math.max(max, data[i].p + (data[i].v * mid));
                    }else{
                        if(data[i].p <max){
                            cross = true;
                            break;
                        }else{
                            double cur = data[i].p + (data[i].v *mid);
                            if(cur < max){
                                cross = true;
                                break;
                            }
                        }
                    }
                }
                if (cross) {
                    once = true;
                    end = mid;
                } else {
                    start = mid;
                }
            }
            if (once) {
                out.println(start);
            }else{
                out.println(-1);
            }
        }





        out.close();
    }

    static class End implements Comparable<End> {

        boolean positive;
        boolean end;
        double pos;

        public End(boolean positive, boolean end, double pos) {
            this.positive = positive;
            this.end = end;
            this.pos = pos;
        }

        @Override
        public int compareTo(End o) {
            if (pos < o.pos) {
                return -1;
            } else if (pos == o.pos) {
                if (positive != o.positive) {
                    return positive ? -1 : 1;
                }
                return 0;
            } else {
                return 1;
            }
        }
    }

    static class P {

        double p, v;

        public P(int p, int v) {
            this.p = p;
            this.v = v;
        }
    }

    public static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y, a.z - b.z);
    }

    public static void rate(Point a, double rate) {
        a.x = a.x * rate;
        a.y = a.y * rate;
        a.z = a.z * rate;
    }

    public static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y, a.z + b.z);
    }

    public static double distance(Point a, Point b) {
        double total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z);
        return Math.sqrt(total);
    }

    public long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static class Point {

        double x, y, z;

        public Point(double x, double y, double z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        public String toString() {
            return x + " " + y + " " + z;
        }
    }

    public static class Edge {

        int num, weight;

        public Edge(int num, int weight) {
            this.num = num;
            this.weight = weight;
        }
    }

    public static void main(String[] args) {
        new E().solve();
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {


            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}