One and Two

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

You are given a sequence a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n. Each element of aa is 11 or 22.

Find out if an integer kk exists so that the following conditions are met.

  • 1kn11 \leq k \leq n-1, and
  • a_1a_2a_k=a_k+1a_k+2a_na\_1 \cdot a\_2 \cdot \ldots \cdot a\_k = a\_{k+1} \cdot a\_{k+2} \cdot \ldots \cdot a\_n.

If there exist multiple kk that satisfy the given condition, print the smallest.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1001 \le t \le 100). Description of the test cases follows.

The first line of each test case contains one integer nn (2n10002 \leq n \leq 1000).

The second line of each test case contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (1a_i21 \leq a\_i \leq 2).

출력

For each test case, if there is no such kk, print 1-1.

Otherwise, print the smallest possible kk.