## Amplitude Hackathon Summer '24 Problem 5 - Lunch Costs

View as PDF

Points: 5 (partial)
Time limit: 0.5s
Memory limit: 1G

Problem type

Catering is expensive! Workplace team knows exactly how many people will come into the office on each of the next days. However, the catering service, for consistency purposes, requires that workplace team order the same amount of food for each of those days.

Catering costs dollars per person per day. It costs dollars to feed a single person pizza on a day where insufficient catering is ordered. It is not possible to order catering or pizza for a fraction of a person - either a person eats entirely via catering for the day or via pizza ordered during that day.

Compute the minimum amount of money that workplace team needs to spend to feed everyone for the next days.

#### Input Specification

The first line contains three integers, , , and .

The next line contains integers. The integer, , is the number of people who will be in the office on day .

#### Output Specification

Output the minimum cost in dollars that workplace team will need to spend.

#### Sample Input 1

2 1 100
10 20

#### Sample Output 1

40

#### Sample Explanation 1

If workplace team orders catering for 20 people, then it will cost 20 dollars every day, or 40 dollars in total.

#### Sample Input 2

2 1 1
10 20

#### Sample Output 2

30

#### Sample Explanation 2

If workplace team orders no catering and just buys pizza every day, then it will only cost 30 dollars.

#### Sample Input 3

1 100000 100000
1000000000

#### Sample Output 3

100000000000000