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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main implements Runnable {
	private boolean _ReadFromFile = false; //System.getProperty("ONLINE_JUDGE") == null;
	private boolean _WriteToFile = false;
	static final String TASK_ID = "in";
	static final String IN_FILE = TASK_ID + ".in";
	static final String OUT_FILE = TASK_ID + ".out";
	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;
	private int[] v;
	private int[] x;

	private void core() throws Exception {
		int n = nextInt();
		v = new int[n];
		x = new int[n];
		for (int i = 0; i < x.length; i++) {
			x[i] = nextInt();
			v[i] = nextInt();
		}
		boolean same = true;
		for (int i = 0; i < x.length; i++) {
			if (v[0] < 0 && v[i] > 0)
				same = false;
			if (v[0] > 0 && v[i] < 0)
				same = false;
		}
		if (same) {
			writer.println("-1");
			return;
		}
		else {
			double d = 0;
			double u = 1e15;
			for (int times = 0; times < 100; times++) {
				double m = (d + u) / 2;
				if (good(m)) 
					u = m;
				else
					d = m;
			}
			if (Math.abs(u - 1e15) < 1e-7)
				writer.println("-1");
			else
				writer.printf("%.12f", u);
		}
	}
	private boolean good(double t) {
		double[] a = new double[v.length];
		for (int i = 0; i < a.length; i++) {
			a[i] = x[i] + v[i] * t;
		}
		double[] min = new double[v.length];
		for (int i = min.length-1; i >= 0; i--) {
			if (i == min.length-1) {
				if (v[i] < 0)
					min[i] = a[i];
				else
					min[i] = Double.POSITIVE_INFINITY;
			}
			else {
				if (v[i] < 0)
					min[i] = Math.min(a[i], min[i+1]);
				else
					min[i] = min[i+1];
			}
		}
		for (int i = 0; i < min.length; i++) {
			if (i + 1 < min.length && v[i] > 0)
				if (a[i] >= min[i+1])
					return true;
		}
		return false;
	}
	void debug(Object...os) {
		System.out.println(Arrays.deepToString(os));
	}
	//--------------------- IO stuffs ---------------------
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Main());
        thread.start();
        thread.join();
    }
	public void run() {
        try {
        	reader = _ReadFromFile ? new BufferedReader(new FileReader(IN_FILE)) : new BufferedReader(new InputStreamReader(System.in));
        	writer = _WriteToFile ? new PrintWriter(OUT_FILE) : new PrintWriter(new BufferedOutputStream(System.out));
            tokenizer = null;
            core();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
    int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
    String nextToken() throws Exception {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}