文理学院程序设计在线练习


Bang!

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 0   Accepted Submission(s): 0
Problem Description

There are N monsters on road. The i-th monster has HP a_i. Xiaoxi need to kill all monsters, she can use fire or water to attack them. Xiaoxi can attack exactly one monster at a time. Water will cost Xiaoxi 1 power and make 1 damage(reduce monster HP by 1) to a monster. Fire will cost Xiaoxi 3 power and make 5 damage(reduce monster HP by 5) to a monster. A monster is killed if and only if its HP lower than or equal to 0.
Please find a way to cost minimum power and kill all monsters.

Input

The first line of input is the number of testcases T.
The first line of each testcase contains a integer N : the number of monsters
Then a line contains N integers : The i-th number represent the HP of i-th monster.
T <= 10
1<= n <= 100000
1<= a_i <= 1000000

Output

For each testcase, output a integer to represent the answer.
It is guaranteed that answer is not out of int range.

Sample Input
2
2
1 2
3
5 1 1
Sample Output
3
5
Source

2019绍兴市计算机技能竞赛