{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"You are in a cave, a deep cave! The cave can be represented by an **1 x N** grid. Some cells in the cave might contain gold!\n\nInitially, you are in position **1**. In each move, you throw a perfect **6** sided dice. If you get **X** in the dice after throwing, you add **X** to your position and collect all the gold from the new position. If your new position is outside of the cave, you keep throwing the dice again until you get a suitable result. When you reach the **N\u003csup\u003eth\u003c/sup\u003e** position you stop your journey.\n\nGiven the information about the cave, you have to find the **expected** amount of gold you can collect using the procedure described above."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026#8804; 100)**, denoting the number of test cases.\n\nEach case contains a blank line and an integer **N (1\u0026#8804; N \u0026#8804; 100)** denoting the dimension of the cave. The next line contains **N** space separated integers. The **i\u003csup\u003eth\u003c/sup\u003e** integer denotes the amount of gold you will get if you come to the **i\u003csup\u003eth\u003c/sup\u003e** cell. You may safely assume that all the given integers will be non-negative and not greater than **1000**."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the expected number of gold you will collect. Errors less than **10\u003csup\u003e-6\u003c/sup\u003e** will be ignored."}},{"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\u003e3\n\n1\n101\n\n2\n10 3\n\n3\n3 6 9\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 101\nCase 2: 13.000000\nCase 3: 15.0000000000\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}