Qualification Round Finished
Given that Shubham is opening a new branch for Tea-Point. He is trying to own and rent the ideal amount of furniture so that he can cater to the ever changing amount of people visiting your shop.
New furniture he wants to buy and rent includes benches and stools.
He wants to serve his customers from 06 in the morning till 12 midnight and will have customers changing at every 2 hour intervals.
He can rent or purchase in consecutive order only. If he’s rented/purchased 1 bench then the next time he has to rent/purchase a pair of stools. But if he wants to purchase a stool individually, he can.
Write an algorithm to find the optimum seating capacity you should own the furniture for and the price for renting the extra furniture.
First line of input T is the number of test cases
First line of each test case has three integers B, C, D
B is per number of hours the renting is available
C is per unit rent price for stool with respect to B
D is per unit rent price for a bench with respect to B
Second line of test case E determines the number of customers at each time interval
Output contains two space separated values. first is number sitting arrangement he should own and second is total amount he spent on renting
Case #1: [Owned seating capacity] [Total renting expense]
1<T<100 (small)
1<T<1000 (large)
1<B<8
Sample Input
2
1 10 20
10 10 5 15 25 30 45 85 85
4 10 20
1 2 3 4 5 8 8 8 9
Sample Output
Case #1: 25 2320
Case #2: 5 50