AT_past17_d Webサービス

Description

You are going to use a feature of a web service for a year. First of all, you must sign up to become a free member, a standard member, or a premium member. - You can become a free member with no charge. A free member can use the feature at most three times a month, but subsequent usage costs $ A $ yen each time. - To become a standard member, you need to pay an annual fee of $ B $ yen on registration. A standard member can use the feature up to $ 50 $ times a month, with each additional use costing $ A $ yen. - To become a premium member, you need to pay an annual fee of $ C $ yen on registration. A premium member can use the feature any number of times for free. For $ i=1,2,\ldots,12 $ , you are going to use the feature $ x_i $ times in the $ i $ -th month. Find the minimum total cost required for the registration and using the feature.

Input Format

The input is given from Standard Input in the following format: > $ A $ $ B $ $ C $ $ x_1 $ $ \ldots $ $ x_{12} $

Output Format

If the answer is $ X $ yen, print the integer $ X $ .

Explanation/Hint

### Sample Explanation 1 Suppose that you become a free member. In the first three months, you will use the features at most three times a month, and no payment is required; for the remaining months, you will use it more than three times a month, so you need to pay $ A $ yen once, twice, $ \ldots $ , and nine times, for a total of $ 225 $ yen. Now consider becoming a standard member. You need to pay the annual fee of $ 20 $ yen on registration, but you will use the feature no more than $ 50 $ times a month, so no further payment is required. If you become a premium member, you first need to pay an annual fee of $ 30 $ yen. But a premium member can use the feature as many times as they want, so no more payment is required. Therefore, the minimum cost is $ 20 $ yen, when you become a standard member. ### Constraints - $ 1 \leq A \leq 1000 $ - $ 1 \leq B \lt C \leq 1000 $ - $ 1 \leq x_i \leq 1000 $ - All input values are integers.