Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 

Chef has three dogs sitting at the vertices of an equilateral triangle. The length of each side of the triangle equals to s meters. Chef gives the command "Start!" and each dog starts to run with constant speed v meters per second. At each moment, each dog is running towards the dog just right to him (in counter-clockwise direction). Therefore, their trajectories are forming some spirals that converging to one point as illustrated below.

How long does it takes dogs to meet each other after the command "Start!"?  

------ Input ------ 

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains two space-separated integers s and v.

------ Output ------ 

For each test case, output a single line containing a real number corresponding to the answer of the problem. The answer will be considered correct if its absolute or relative error does not exceed 10^{-6}.

------ Constraints ------ 

$1 ≤ T ≤ 10$
$1 ≤ s, v ≤ 10^{9}$

------ Subtasks ------ 

$Subtask #1 (40 points): 1 ≤ s, v ≤ 10$
$Subtask #2 (60 points): original constraints$

----- Sample Input 1 ------ 
2
2 5
1 1000000000
----- Sample Output 1 ------ 
0.266667
0.0000001
----- explanation 1 ------ 
Due to the triangle being very small, but the dogs running extremely fast, they will meet after less than 1e-6 seconds. Thus, due to remark about absolute or relative error in the output section, any answer within [0, 1e-6] will be considered correct.

Difficulty: MEDIUM
Tags: Geometry

Mathematics

Starter code:

Solutions:
for t in range(int(input())):
	(s, v) = map(int, input().split())
	print(round(2 * s / (3 * v), 6))


for _ in range(int(input())):
	(s, v) = map(int, input().split())
	t = s * 2 / (v * 3)
	print(t)


import math
t = int(input())
for _ in range(t):
	(s, v) = map(int, input().split())
	a = 2 * s / (3 * v)
	print(a)


for sad in range(int(input())):
	(s, v) = map(int, input().split(' '))
	print('%.10f' % (2 * s / (3 * v)))


tests = int(input())
for i in range(tests):
	(s, v) = map(int, input().split())
	print(2 * s / (3 * v))


t = int(input())
for i in range(t):
	(s, v) = map(int, input().split(' '))
	x = 2 * s / (3 * v)
	if x < 1e-07:
		print('0.0000001')
	else:
		print(round(x, 7))


for _ in range(int(input())):
	(s, v) = map(int, input().split())
	ans = s / (1.5 * v)
	print(round(ans, 6))


T = int(input())
for _ in range(T):
	(s, v) = map(int, input().split())
	ans = 2 * s / (3 * v)
	print(ans)


try:
	x = int(input())
	for _ in range(x):
		mid = 2 / 3
		(a, b) = map(int, input().split(' '))
		time = a * mid / b
		print(time)
except:
	pass


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = 2 * a / (3 * b)
	print(s)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	time = 2 * a / (3 * b)
	print(time)


for _ in range(int(input())):
	(s, v) = map(int, input().split())
	print('%.10f' % max(2 * s / (3 * v), 1e-07))


for t in range(int(input())):
	(s, v) = map(int, input().split())
	a = 2 * s / (3 * v)
	print(a if a > 10 ** (-6) else 0)


for _ in range(int(input())):
	(S, v) = map(int, input().split())
	print(2.0 * S / (3 * v))


for _ in range(int(input())):
	(s, v) = map(int, input().split())
	print('{:.6f}'.format(2 / 3 * s / v))


t = int(input())
while t:
	(s, v) = map(int, input().split())
	s1 = 2 * s
	s2 = 3 * v
	print(s1 / s2)
	t = t - 1


from collections import defaultdict
from bisect import bisect_right
for _ in range(int(input())):
	(s, v) = map(int, input().split())
	a = 2 * s / (3 * v)
	print(a)


t = int(input())
for _ in range(t):
	(s, v) = map(int, input().strip().split(' '))
	dist = 2 / 3 * s
	time = dist / v
	print('{:.6f}'.format(time))


for u in range(int(input())):
	(x, y) = map(int, input().split())
	ans = 2 * x / (3 * y)
	print(ans)


t = int(input())
for _ in range(t):
	string = input().split()
	s = int(string[0])
	v = int(string[1])
	time = 2 * s / (3 * v)
	print(time)


for _ in range(int(input())):
	(s, v) = [int(s) for s in input().split()]
	print(0.6666666666666667 * s / v)


T = int(input())
for i in range(0, T):
	(s, v) = map(int, input().split())
	print(2 * s / (3 * v))


try:
	t = int(input())
	for k in range(0, t):
		(s, v) = map(float, input().split())
		print(round(s / (1.5 * v), 18), '\n')
except EOFError:
	pass


t = int(input())
for i in range(0, t):
	(s, v) = [int(x) for x in input().split()]
	print(2 * s / (3 * v))


for i in range(int(input())):
	(a, v) = input().split()
	print(2 * float(a) / (3 * int(v)))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split(' '))
	s = 2 * a
	v = 3 * b
	print(s / v)
	t -= 1


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	a1 = a * 2
	b1 = b * 3
	print(a1 / b1)


t = int(input())
for i in range(0, t):
	numbers = list(map(int, input().split()))
	num = 2 * int(numbers[0]) / (3 * int(numbers[1]))
	num = float('%0.6f' % num)
	print(num)


for _ in range(int(input())):
	(s, v) = list(map(int, input().split()))
	ans1 = 2 * s
	ans2 = 3 * v
	ans = ans1 / ans2
	print(ans)


q = int(input())
for i in range(q):
	(x, y) = map(int, input().strip().split())
	ans = 2 * x / (3 * y)
	print(ans)


t = int(input())
while t > 0:
	(s, v) = map(int, input().split())
	print(float(2 * s / (3 * v)))
	t -= 1


t = int(input())
for i in range(0, t):
	(s, v) = input().strip().split()
	s = int(s)
	v = int(v)
	z = 2 * s / (3 * v)
	print('%.6f' % round(z, 6))


t = int(input())
for i in range(t):
	(s, v) = input().split(' ')
	s = float(s)
	v = float(v)
	h = 2 * s / (3 * v)
	print('%lf' % h)


t = int(input(''))
d = []
for i in range(0, t):
	(a, b) = map(int, input('').split())
	c = 2 * a / (3 * b)
	d.append(c)
for j in range(0, t):
	print('{0:.6f}'.format(d[j]))


for _ in range(int(input())):
	[a, b] = [int(i) for i in input().split()]
	print(2 * a / (3 * b))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	print('%.9f' % (2 * a / (3 * b)))


t = int(input())
while t:
	t -= 1
	(s, v) = input().split()
	print(round(float(2.0 / 3 * (float(s) / float(v))), 6))


for testcases in range(int(input())):
	(s, v) = map(int, input().split())
	a = 2 * s
	b = 3 * v
	ans = a / b
	print(round(ans, 6))


t = int(input())
while t:
	t -= 1
	(s, v) = map(int, input().split())
	ans = 2 * s / (3 * v)
	print(ans)


from decimal import Decimal
for _ in range(int(input())):
	(s, v) = map(int, input().split())
	res = 2 * s / 3 / v
	print(round(res, 6))


import math

def find_arc_length(r, a):
	return r / math.cos(a)

def find_centroid(s):
	return math.sqrt(s ** 2 - (s / 2) ** 2) * 2 / 3
t = int(input())
for i in range(t):
	line = input()
	line = line.split()
	s = int(line[0])
	v = int(line[1])
	print(find_arc_length(find_centroid(s), math.pi / 6) / v)