{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eThis class is on PE. Today, Baby Volcano is going to take part in a running competition in a maze. Could you help him win this competition? \u003cbr\u003e\u003cbr\u003eFor simplicity, we assume that this maze lies in a Euclidean plane. There is a graphical description for the maze shown in the following figure. We give some explanation here:\u003cbr\u003e\u003cbr\u003e1. There are two kinds of obstructions in this maze, walls and doors. In the figure, black segments and rays are walls, red segments are doors. Some doors are closed while others are open. Baby volcano couldn\u0027t go through walls and closed doors, while he could pass open doors. He couldn\u0027t tell whether a door is open or not before reaching $its\\ midpoint$. \u003cbr\u003e\u003cbr\u003e2. In the outmost layer there are $5$ pieces of walls, corresponding to segment $GE,EF,FH$, and ray $GI,HJ$.\u003cbr\u003e\u003cbr\u003e3. In the inner part there are $n$ layers of obstructions, the obstructions in the $i$-layer lies in $y\u003di$, consists of $i$ doors and $i-1$ walls, every obstruction is a segment with length $1$. The $j$-th door$(1\\leq j \\leq i)$ in $i$-th layer is the segement $\\left(\\left(\\frac{1-2i}{2}+2j-2,i\\right),\\left(\\frac{1-2i}{2}+2j-1,i\\right)\\right)$. The $j$-th wall$(1\\leq j \\leq i-1)$ in $i$-th layer is the segement \u003cbr\u003e$\\left(\\left(\\frac{1-2i}{2}+2j-1,i\\right),\\left(\\frac{1-2i}{2}+2j,i\\right)\\right)$\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/4ea5f57fcbc53d0b9ce90e767c682bc1?v\u003d1726673389\"\u003e\u003c/center\u003e\u003cbr\u003e\u003cbr\u003eNow for every $1\\leq i\\leq n$, the teacher uniformly randomly choose $k_i$($1\\leq k_i\\leq i$) doors to be open. Baby Volcano wonders, if he starts at $(x_0,n+1)$, and try to approach $(0,0)$, what is the minimum expected length of walk?\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"In the first line there is a number $T$, denotes the number of test cases.\u003cbr\u003e\u003cbr\u003eNext, there are $2\\times T$ lines demonstrating each test case.\u003cbr\u003e\u003cbr\u003eFor every case, in the first line there are two integers, $n,x_0$, denotes the number of layers in this maze and the start position of Baby Volcano.\u003cbr\u003e\u003cbr\u003eIn the second line there are $n$ integers $k_1,k_2,k_3,\\cdots,k_n$, showing the number of doors open in the $i$-th layer.\u003cbr\u003e\u003cbr\u003eThe input guarantees that $1 \\leq T \\leq 100,1 \\leq n \\leq 50$, and $-n\\leq x_0\\leq n$."}},{"title":"Output","value":{"format":"HTML","content":"Output $T$ real numbers, for each test case, you need to output $d$, denotes the minimum expected length of walk. You need to output six decimal places."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n2 1\r\n1 2\r\n2 1\r\n1 1\r\n3 2\r\n1 2 3\r\n4 2\r\n1 2 2 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3.414213\r\n4.414213\r\n4.828427\r\n10.323520\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}