#Lutece0608. Bandwidth

Bandwidth

Migrated from Lutece 608 Bandwidth

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Study in BUPT, you cannot get rid of the word bandwidth. Nearly all the courses like "Signal and System", "Digital Signal Processing", "Communication Theory" are related to the bandwidth.

In the night before the exam of Signal and System, you got an incredible filter. In the frequency spectrum, if the maximal amplitude is XX, then those frequency amplitude is less than X2\frac{X}{2} would be filtered.

Now your task is to simulate the incredible filter and figure out the bandwidth after being filtered.

Input

First line contains an integer TT (0<T100 < T \leq 10), indicate there are TT cases.

For each case, the first line contains an integer NN (0<N<10000 < N < 1000), indicate the bandwidth of the frequency spectrum before being filtered.

Then comes NN lines, only formed by - whose length indicate the frequency amplitude (maximal length is not greater than 10001000).

It guaranteed the maximal length in every case will greater than zero.

Output

One line per case.

Each line contains only an integer indicate the bandwidth of the frequency spectrum after being filtered.

Samples

2
6
-
--
----
-
--
-
10
--
--
--
---
-----
------
-----
----
--
-
4
5

Resources

6th BUPT Programming Contest Final