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.IOException;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.Collections;

public class BerlandCollider {	
	public static void main(String[] args) throws IOException {
		BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(rd.readLine());
		
		// Preberi delce in jih razdeli v smiselne skupine (npr. skupin, kjer
		// se vsi delci premikajo v enako smer ne dodajmo
		LinkedList<ArrayList<Particle>> skupine = new LinkedList<ArrayList<Particle>>();
		ArrayList<Particle> nGroup = new ArrayList<Particle>();
		int lastDir = 0;
		int pos = 0, neg = 0;
		for (int i = 0; i < n; i++) {
			String[] nLine = rd.readLine().split(" ");
			int x = Integer.parseInt(nLine[0]);
			int v = Integer.parseInt(nLine[1]);
			if (v < 0) neg++;
			if (v > 0) pos++;
			if (lastDir < 0 && v > 0) {
				if (pos > 1) skupine.add(nGroup);
				nGroup = new ArrayList<Particle>();
			}
			nGroup.add(new Particle(x, v));
			lastDir = v;
		}
		if (neg == n || pos == n) {System.out.println(-1); return;}
		if (lastDir < 0)
		skupine.add(nGroup);
		
		// Izracunaj cas prvega trka:
		double up = 1e10;
		double down = 0;
		boolean isHit = false;
		for (int i = 0; i < 100; i++) {
			double t = (up+down)/2;
			Particle.t = t;
			boolean hit = compute(skupine);
			if (hit) {
				isHit = true;
				up = t;
			}
			else {
				down = t;
			}
		}
		System.out.printf("%.20f%n", isHit ? (up+down)/2 : -1);
	}
	
	private static boolean compute(LinkedList<ArrayList<Particle>> s) {
		for (ArrayList<Particle> nList : s) {
			// Sortiraj po legi v casu:
			Collections.sort(nList);
			// Najdi prvi par v urejenem seznamu od leve proti desni,
			// kjer je delec z negativno hitrostjo pred delcem z pozitivno
			boolean negative = false;
			for (Particle p : nList) {				
				if (p.v < 0) negative = true;
				else if (p.v > 0 && negative) return true;
			}
		} 
		return false;
	}
	
	private static class Particle implements Comparable<Particle> {
		int x, v;
		static double t;
		
		public Particle(int x, int v) {
			this.x = x;
			this.v = v;
		}
		
		public String toString() {
			return String.format("Particle: x=%d, v=%d", x, v);
		}
		
		public int compareTo(Particle p) {
			if (x + v*t < p.x+p.v*t) return -1;
			else if (x + v*t > p.x+p.v*t) return 1;
			else return 0;
		}
	}
}