Lab Schedule

Pick days to experiment so no two chosen days are within two days of each other, maximizing the sum of visit probabilities.

Medium4Dynamic programmingGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

Your friend Susan works in a biology lab. The rules there are strict, and she wants her boss to see her running an experiment. A single day of experiments drains her, so after every day she spends experimenting she needs at least two days off to recover. If she runs an experiment on Monday, the earliest she can run the next one is Thursday of the same week.

From the visit history Susan knows the probabilities P={p1,p2,,pn}P = \{p_1, p_2, \dots, p_n\} for nn days, where pip_i is the probability that her boss visits the lab on day ii. She can experiment on as many days as she likes as long as she rests in between. Choose the schedule that maximizes the sum of the probabilities on the days she experiments, and report that maximum.

Input

The first line contains the number of test cases TT. (0<T200 < T \le 20)

Each test case takes two lines. The first line contains the number of recorded days nn. (0<n10000 < n \le 1000) The second line contains nn probabilities, the chance that her boss visits on each day from day 11 to day nn, separated by single spaces. Each probability is a decimal number between 00 and 11, inclusive.

Output

For each test case, print the maximum total probability on its own line. Round the exact total to one decimal place, rounding a half up, and always print that one decimal digit. No exact total in the test data lands on a rounding boundary.