{"raw_statement":[{"iden":"statement","content":"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.\n\nAnvils 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!\n\nIt 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.\n\nLet 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:\n\nDetermine the probability with which an aim can be successfully hit by an anvil.\n\nYou can assume that the _p_ and _q_ coefficients are chosen equiprobably and independently in their ranges."},{"iden":"input","content":"The first line contains integer _t_ (1 ≤ _t_ ≤ 10000) — amount of testcases.\n\nEach of the following _t_ lines contain two space-separated integers _a_ and _b_ (0 ≤ _a_, _b_ ≤ 106).\n\nPretests contain all the tests with 0 < _a_ < 10, 0 ≤ _b_ < 10."},{"iden":"output","content":"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."},{"iden":"examples","content":"Input\n\n2\n4 2\n1 2\n\nOutput\n\n0.6250000000\n0.5312500000"}],"translated_statement":[{"iden":"statement","content":"出于某种原因，在许多美国卡通中，铁砧会不时从天而降砸在主角头上。当然，保险箱、衣柜、巡洋舰、飞机有时也会掉下来……但最常掉的还是铁砧。\n\n铁砧有不同的尺寸和形状。它们常常把主角深深砸进地里。但你是否曾想过，是谁从天上扔下铁砧的？从多高的地方扔的？我们相信，这样的问题从未困扰过你！\n\n事实证明，正确地扔下铁砧并非易事。让我们描述其中最流行的一种铁砧投掷模型。\n\n假设潜在受害者所处的高度 #cf_span[p] 在范围 #cf_span[[0;a]] 内变化，风向 #cf_span[q] 在范围 #cf_span[[ - b;b]] 内变化。#cf_span[p] *和* #cf_span[q] *可以是任意实数（浮点数）。我们可以假设，只有当以下方程至少有一个实根时，铁砧才能完美砸中卡通人物的头部：\n\n请计算铁砧成功击中目标的概率。\n\n你可以假设系数 #cf_span[p] 和 #cf_span[q] 在其各自范围内均匀且独立地随机选取。\n\n第一行包含整数 #cf_span[t] (#cf_span[1 ≤ t ≤ 10000]) —— 测试用例的数量。\n\n接下来的 #cf_span[t] 行每行包含两个用空格分隔的整数 #cf_span[a] 和 #cf_span[b] (#cf_span[0 ≤ a, b ≤ 106])。\n\n预测试包含所有满足 #cf_span[0 < a < 10, 0 ≤ b < 10] 的测试用例。\n\n请输出 #cf_span[t] 行——每个测试用例对应一个铁砧成功击中目标的概率。答案的绝对误差或相对误差不得超过 #cf_span[10 - 6]。\n\n"},{"iden":"input","content":"第一行包含整数 #cf_span[t] (#cf_span[1 ≤ t ≤ 10000]) —— 测试用例的数量。接下来的 #cf_span[t] 行每行包含两个用空格分隔的整数 #cf_span[a] 和 #cf_span[b] (#cf_span[0 ≤ a, b ≤ 106])。预测试包含所有满足 #cf_span[0 < a < 10, 0 ≤ b < 10] 的测试用例。"},{"iden":"output","content":"请输出 #cf_span[t] 行——每个测试用例对应一个铁砧成功击中目标的概率。答案的绝对误差或相对误差不得超过 #cf_span[10 - 6]。"},{"iden":"examples","content":"输入24 21 2输出0.62500000000.5312500000"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ a, b \\in \\mathbb{R}_{\\geq 0} $.  \nLet $ p \\sim \\mathcal{U}[0, a] $, $ q \\sim \\mathcal{U}[-b, b] $, with $ p $ and $ q $ independent.  \n\nConsider the quadratic equation in $ x $:  \n$$\nx^2 + px + q = 0\n$$\n\n**Constraints**  \n1. $ 1 \\le t \\le 10000 $  \n2. For each test case: $ 0 \\le a \\le 10^6 $, $ 0 \\le b \\le 10^6 $\n\n**Objective**  \nCompute the probability that the equation $ x^2 + px + q = 0 $ has at least one real root, i.e., that the discriminant is non-negative:  \n$$\nD = p^2 - 4q \\geq 0\n$$  \nover the uniform distribution of $ p \\in [0, a] $, $ q \\in [-b, b] $.  \n\nThat is, compute:  \n$$\n\\mathbb{P}\\left(p^2 - 4q \\geq 0\\right) = \\frac{1}{a \\cdot 2b} \\iint\\limits_{\\substack{0 \\le p \\le a \\\\ -b \\le q \\le b \\\\ p^2 - 4q \\geq 0}} dq\\,dp\n$$  \n(with the understanding that if $ a = 0 $ or $ b = 0 $, the probability is handled as a degenerate case).","simple_statement":null,"has_page_source":false}