408474: GYM103145 I Takeaway

Memory Limit:256 MB Time Limit:10 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Takeawaytime limit per test10 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

After CET-6, Kanari wants to order a takeaway to reward himself.

He opens choutuan app and starts to choose what to eat for his dinner. There are 7 types of dishes in total, the price of which are $$$7, 27, 41, 49, 63, 78, 108$$$ yuan respectively.

Kanari has three coupons:

1. When the price reaches $$$69$$$ yuan, you will get $$$15$$$ yuan off.

2. When the price reaches $$$89$$$ yuan, you will get $$$30$$$ yuan off.

3. When the price reaches $$$120$$$ yuan, you will get $$$50$$$ yuan off.

Kanari can only use one coupon each time and each coupon can only be used once. For each order, the app will always choose the best coupon for him.

For example, if the overall price of his order is $$$300$$$ yuan, he will need to pay $$$250$$$ yuan.

Now Kanari ordered $$$n$$$ dishes, $$$a_1, a_2, a_3, ..., a_n$$$, denoting the types of the dishes respectively. He wants to know how much he will spend on his dinner.

Input

This problem contains multiple test cases.

The first line contains a single integer $$$T$$$ ($$$1\leq T\leq 10^6$$$) indicating the number of test cases.

Then $$$T$$$ cases follow, each of which contains two lines.

The first line of each test case contains an integer $$$n$$$ ($$$1\leq n\leq 7$$$), the number of dishes Kanari ordered.

The second line contains $$$n$$$ integers $$$a_1,a_2,...,a_n$$$. ($$$1\leq a_i\leq 7$$$) indicating the dishes Kanari ordered.

Output

For each test case, output the money Kanari spends in a single line.

ExampleInput
5
2
2 3
3
2 3 4
6
1 1 4 5 1 4
1
1
7
7 7 7 7 7 7 7
Output
68
87
132
7
706

加入题单

上一题 下一题 算法标签: