#P7745. [2019年杭电多校]Rikka with Coin

[2019年杭电多校]Rikka with Coin

Rikka with Coin

Problem Description

Rikka hates coins, and she used to never carry any coins with her. These days, Rikka is doing her summer internship abroad. Without mobile payment, Rikka has to face strange prices of commodities, and as a result of always using paper currency, she has to face mountainous coins on here table. In the local currency system, there are 44 kinds of coins: 1010 cents, 2020 cents, 5050 cents and 11 dollar. Up to now, Rikka has gained at least 1010010^{100} coins for each kind. Now, Rikka is going to have dinner in the canteen, and she decides to pay the bill only with coins. There are nn different combos in the canteen and the price of the iith is wiw_i cents. Rikka would like to choose one combo as dinner but she has not decided to choose which one yet. Therefore, she wants to take some coins so that whichever she chooses, she can always pay the bill without receiving any change. Since Rikka hates coins, she wants to carry as few coins as possible with her. As it is generally known that Rikka is not good at math, she wants you to help her make the decision.

Input

The first line of the input contains a single integer T(1T500)T(1 \leq T \leq 500), the number of test cases. For each test case, the first line contains a single integer n(1n100)n(1 \leq n \leq 100), the number of combos sold in the canteen. The second line contains nn positive integers w1,,wn(1wi109)w_1, \dots, w_n(1 \leq w_i \leq 10^9), which represents the prices.

Output

For each test case, output a single line with a single integer which represents the minimum number of coins. If there is no valid solution, output 1-1. Hint In the first test case, one optimal solution is to bring one coin of 1010 cents and two coins of 2020 cents. In the second test case, one optimal solution is to bring 55 coins of one dollar.

Sample Input

3

5

10 20 30 40 50

5

100 200 300 400 500

1

1

Sample Output

3

5

-1

Source

2019 Multi-University Training Contest 9