Problem: For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.

Anvils come in different sizes and shapes. Quite often they get the hero stuck deep in the ground. But have you ever thought who throws anvils from the sky? From what height? We are sure that such questions have never troubled you!

It turns out that throwing an anvil properly is not an easy task at all. Let's describe one of the most popular anvil throwing models.

Let the height p of the potential victim vary in the range [0;a] and the direction of the wind q vary in the range [ - b;b]. p and q could be any real (floating) numbers. Then we can assume that the anvil will fit the toon's head perfectly only if the following equation has at least one real root: 

<image>

Determine the probability with which an aim can be successfully hit by an anvil.

You can assume that the p and q coefficients are chosen equiprobably and independently in their ranges.

Input

The first line contains integer t (1 ≤ t ≤ 10000) — amount of testcases.

Each of the following t lines contain two space-separated integers a and b (0 ≤ a, b ≤ 106).

Pretests contain all the tests with 0 < a < 10, 0 ≤ b < 10.

Output

Print t lines — the probability of a successful anvil hit for each testcase. The absolute or relative error of the answer should not exceed 10 - 6.

Examples

Input

2
4 2
1 2


Output

0.6250000000
0.5312500000

Solution (in JAVA):

Solution:

import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;

public class Main {
 
    static double EPS = 1e-8;
    
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder out = new StringBuilder();
        StringTokenizer tk;
        
        int tc = parseInt(in.readLine());
        
        while(tc-- > 0) {
            tk = new StringTokenizer(in.readLine());
            double a = parseDouble(tk.nextToken()),b = parseDouble(tk.nextToken());
            
            if(abs(b)<=EPS) {
                System.out.println("1.00000000000");
                continue;
            }
            if(abs(a)<=EPS) {
                System.out.println("0.5000000000");
                continue;
            }
            
            point p1 = new point(-b,0.0);
            point p2 = new point(-b,a);
            point p3 = new point(b,a);
            point p4 = new point(b,0.0);
            
            List<point> poly = new ArrayList<>();
            
            line l1 = new line(-4.0,1.0,0.0);
            
            point A = areIntersect(l1, toLine(p1,p2));
            if(!(abs(A.x-p1.x) <= EPS && (A.y-p1.y)> -EPS && (p2.y-A.y)> -EPS)) 
                A = null;
            point B = areIntersect(l1, toLine(p2,p3));
            if(!((B.x-p2.x)> -EPS && (p3.x-B.x)> -EPS && abs(B.y-p2.y) <= EPS)) 
                B = null;
            point C = areIntersect(l1, toLine(p3,p4));
            if(!(abs(C.x-p4.x) <= EPS && (C.y-p4.y)> -EPS && (p3.y-C.y)> -EPS)) 
                C = null;
            point D = areIntersect(l1, toLine(p1,p4));
            
            //System.out.println(B+" "+C+" "+D);
            if(C==null) {
                poly.add(D);
                poly.add(B);
                poly.add(p2);
                poly.add(p1);
                poly.add(D);
            } else {
                poly.add(D);
                poly.add(C);
                poly.add(p3);
                poly.add(p2);
                poly.add(p1);
                poly.add(D);
            }
            
            //System.out.println(areaOfPolygon(poly)+" "+(2.0*b*a));
            System.out.println(areaOfPolygon(poly)/(2.0*b*a));
        }
    }
    
    static boolean areParallel(line l1,line l2) {
        return (abs(l1.a-l2.a)<EPS) && (abs(l1.b-l2.b)<EPS);
    }
    
    static point areIntersect(line l1,line l2) {
        point p = new point(0.0,0.0);
        
        if(areParallel(l1,l2)) return null;
        
        p.x = (l2.b*l1.c-l1.b*l2.c)/(l2.a*l1.b-l1.a*l2.b);
        if(abs(l1.b)>EPS) p.y = -(l1.a*p.x+l1.c);
        else p.y = -(l2.a*p.x+l2.c);
        
        return p;
    } 
    
    static line toLine(point a,point b) {
        if(abs(a.x-b.x)<EPS) 
            return new line(1.0,0.0,-a.x);
        
        line l = new line(-(double)(a.y-b.y)/(a.x-b.y),1.0,0.0);
        l.c = -(double)(l.a*a.x)-a.y;
        return l;
    }
    
    static vector toVector(point a,point b) {
        return new vector(b.x-a.x, b.y-a.y);
    }
    
    static double cross(vector a,vector b) {
        return a.x*b.y - a.y*b.x;
    }
    
    static point lineIntersectSeg(point p,point q,point a,point b) {
        double A = b.y-a.y;
        double B = a.x-b.x;
        double C = b.x*a.y-a.x*b.y;
        double u = abs(A*p.x + B*p.y + C);
        double v = abs(A*q.x + B*q.y + C);
        
        return new point((p.x*v+q.x*u)/(u+v), (p.y*v+q.y*u)/(u+v));
    }
    
    static List<point> cutPolygon(point a,point b,List<point> Q) {
        List<point> P = new ArrayList<>();
        
        for(int i=0; i<Q.size(); i++) {
            double left1 = cross(toVector(a,b), toVector(a,Q.get(i))),left2 = 0.0;
            
            if(i!=Q.size()-1) left2 = cross(toVector(a,b), toVector(a,Q.get(i+1)));
            
            if(left1 > -EPS) P.add(Q.get(i));
            if(left1*left2 < -EPS) P.add(lineIntersectSeg(Q.get(i),Q.get(i+1),a,b));
        }
        
        if(!P.isEmpty() && !(P.get(0).x==P.get(P.size()-1).x && P.get(0).y==P.get(P.size()-1).y))
            P.add(new point(P.get(0).x,P.get(0).y));
        
        return P;
    }
    
    static double areaOfPolygon(List<point> p) {
        double ans = 0.0,x1,y1,x2,y2;
        
        for(int i=0; i<p.size()-1; i++) {
            x1 = p.get(i).x;
            y1 = p.get(i).y;
            
            x2 = p.get(i+1).x;
            y2 = p.get(i+1).y;
            
            ans += (x1*y2-x2*y1);
        }
        
        return abs(ans)/2.0;
    }
    static class point {
        double x,y;
        
        public point(double x,double y) {
            this.x = x;
            this.y = y;
        }
        
        @Override
        public String toString() {
            return " ("+x+" , "+y+") ";
        }
    }
    
    static class vector {
        double x,y;
        
        public vector(double x,double y) {
            this.x = x;
            this.y = y;
        }
    }
    
    static class line {
        double a,b,c;
        
        public line(double a,double b,double c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }
    }
}