import math T = int(input()) def normal(t): while 0 > t: t += 2*math.pi while 2*math.pi <= t: t -= 2*math.pi return t for _ in range(T): x1,y1,r1 = map(int,input().split()) x2,y2,r2 = map(int,input().split()) ans = 0 x0 = x2 - x1 y0 = y2 - y1 r0 = math.sqrt(x0**2 + y0**2) alpha = math.atan2(x0, y0) theta1 = math.asin((r1+r2)/r0) - alpha theta2 = math.pi - math.asin((r1+r2)/r0) - alpha theta3 = math.asin((r1-r2)/r0) - alpha theta4 = math.pi - math.asin((r1-r2)/r0) - alpha #print("alpha :",alpha) thetas = [theta1, theta2, theta3, theta4] for the in thetas: X = r1*math.cos(the) Y = r1*math.sin(the) a = X b = Y c = -r1**2 - x1 * X - y1 * Y #print(a,b,c) M = max(abs(a), abs(b), abs(c)) ans += abs(a+b+c)/M print(ans)