F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Takeaway

Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 166    Accepted Submission(s): 134


Problem Description
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.
 

Sample Input
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
 

Sample Output
68 87 132 7 706
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 07:21:37, Gzip enabled