Problem A

Almost Circle

Submit File

Input File

Output File

Time Limit

: circle.exe | circle.class

: circle.in

: circle.out

: 1 second


Problem Description

By the definition, a circle is the set of all points in a plane at a fixed distance (radius) from a given point (center). A circle can be made from a regular polygon (all sides have the same length, and all angles are congruent) of an infinite number of corners.

In this problem, we would like to deal with an almost circle. An almost circle is a regular N-gon that has a difference (D, read: delta) area with the circle less than or equal to P.

The picture above shows us a figure of a polygon with 6 corners (6-gon) and its D area. As you might figure out, the more you have corners, the smaller D area will be. In fact, if we have infinite corners, then D area will be zero (and it is a circle).

Given the circle radius R and maximum D area P, find out N the minimum corner needed to form an almost circle.


Input Speficication

The first line of input contains an integer T, the number of test cases follow.

Each case consists of two integers, R (1 <= R <= 1,000) the circle radius, and P (1 <= P <= 1,000,000) the maximum D area.


Output Speficication

For each case, print in a single line, N the minimum number of corners needed to form an almost circle. You may safely assume that N will be less than 1000.



Sample Input

Output for Sample Input

4
7 60
7 100
7 40
7 27
4
3
5
6



BNPC-HS 2007 Final Round, Problem A - Almost Circle