#SDNU1403. Planet Destruction

Planet Destruction

Description

Planet Destruction

Darth Vader is back to his favourite hobby: destroying planets (or their population to be precise). He just discovered that the rebel leadership has gathered at a planet named Watooine, so he must act quickly to eliminate the threat. Unfortunately, the Empire is in a pretty bad recession right now, so there aren't any Death Stars left around. Therefore, Vader's plan involves dropping several containers with deadly viruses onto the planet's surface.

To make things simpler for you, we will model this problem in 2D. Watooine has radius R and is centred at (0,0)(0,0). There are K Empire spaceships, each of which will simultaneously launch a rocket with a container towards point (0,0)(0, 0). Once the rocket hits the surface of the planet, aa virus will start spreading along the surface in the shape of a circle of ever increasing radius. Since we are modelling the problem in 2D, the virus spreads from the point of impact at the same rate in both directions, clockwise and counterclockwise along the circumference of the circle that represents the surface of the planet. Each spaceship has a custom rocket speed, and each virus has a custom spread speed. Note that each virus spreads along the surface of the planet - it cannot pass through the planet to reach the other end.

Your task is to determine how much time will it take for Watooine to become completely infected - i.e. every point on the planet surface has been reached by a virus. Good luck!

Format

Input

The first line contains TT, the number of test cases, followed by the descriptions of the TT test cases. Each test case description has the following structure: The first line contains two integers RR, the radius of the planet (in meters), and KK, the number of spaceships. The next KK lines each contain 44 integers: the XX-coordinate of the ship, the YY-coordinate of the ship, the rocket speed and the virus spread speed (in meters per second). It is guaranteed that no ships are inside the planet. Both speeds are between 11 and 10000001000000, both coordinates are between 1000000-1000000 and 10000001000000, R is between 1 and 1000000. KK is between 11 and 1000010000, and T is between 11 and 100100.

Output

For each test case, print one line containing one real number, the time it takes for the planet to become completely infected. Your answer will be considered correct if it is within 10-4 from the jury answer.

Samples

1
100 1
200 0 10 7
54.879894378