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.