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.util.*;


public class E
{
   public static void main(String[] args)
   {
      new E(new FastScanner());   
   }

   ArrayList<Pair> pos;
   ArrayList<Pair> neg;
   ArrayList<Pair> vs;

   boolean go(double t)
   {
      ArrayList<Double> us = new ArrayList<Double>();
      
      double hi = -9999999999999999.0;
      int i = 0;

      for (Pair p : neg)
      {
         while ((i < pos.size())&&(pos.get(i).x <= p.x))
         {
            hi = Math.max(hi, pos.get(i).x+pos.get(i).v*t);
            i++;
         }

         double r = p.x+p.v*t;
         if (r <= hi) return true;
      }

      return false;
   }

   public E(FastScanner in)
   {
      int N = in.nextInt();

      pos = new ArrayList<Pair>();
      neg = new ArrayList<Pair>();
      vs = new ArrayList<Pair>();
      for (int i=0; i<N; i++)
      {
         int x = in.nextInt();
         int v = in.nextInt();
         Pair p = new Pair(x, v);
         if (v > 0)
            pos.add(p);
         else
            neg.add(p);
         vs.add(p);
      }

      Collections.sort(pos);
      Collections.sort(neg);

      if (((pos.size() == 0)||(neg.size() == 0))||
          (pos.get(0).x > neg.get(neg.size()-1).x))
      {
         System.out.println("-1");
         return;
      }

      double MAX = 3000000000.0;
      
      double lo = 0.0;
      double hi = 2.0;
      
      while ((hi < MAX)&&(!go(hi)))
         hi *= 2;
      
      for (int i=0; i<200; i++)
      {
         if ((hi-lo)<1e-9) break;

         double m = (lo+hi)/2.0;
         
         if (go(m))
            hi = m;
         else
            lo = m;
      }
      
      if (lo > (MAX-1)) 
      {
         System.out.println("-1");
         return;
      }
      
      System.out.printf("%.20f%n", lo);
   }
}


class Pair implements Comparable<Pair>
{
   int x, v;

   public Pair(int xx, int vv)
   {
      x = xx;
      v = vv;
   }

   public int compareTo(Pair rhs)
   {
      return x-rhs.x;
   }
}

class FastScanner{
    int nextInt(){
        try{
            int c=System.in.read();
            if(c==-1) return c;
            while(c!='-'&&(c<'0'||'9'<c)){
                c=System.in.read();
                if(c==-1) return c;
            }
            if(c=='-') return -nextInt();
            int res=0;
            do{
                res*=10;
                res+=c-'0';
                c=System.in.read();
            }while('0'<=c&&c<='9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }
    
    long nextLong(){
        try{
            int c=System.in.read();
            if(c==-1) return -1;
            while(c!='-'&&(c<'0'||'9'<c)){
                c=System.in.read();
                if(c==-1) return -1;
            }
            if(c=='-') return -nextLong();
            long res=0;
            do{
                res*=10;
                res+=c-'0';
                c=System.in.read();
            }while('0'<=c&&c<='9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }
    
    double nextDouble(){
        return Double.parseDouble(next());
    }
    
    String next(){
        try{
            StringBuilder res=new StringBuilder("");
            int c=System.in.read();
            while(Character.isWhitespace(c))
                c=System.in.read();
            do{
                res.append((char)c);
            }while(!Character.isWhitespace(c=System.in.read()));
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }
    
    String nextLine(){
        try{
            StringBuilder res=new StringBuilder("");
            int c=System.in.read();
            while(c=='\r'||c=='\n')
                c=System.in.read();
            do{
                res.append((char)c);
                c=System.in.read();
            }while(c!='\r'&&c!='\n');
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }
}