input
1 3 7 19
2 3
2 5
4 4 4
output
12
In this problem, we have to find the minimum sum of burles Vasya will spend. According to this example, the output should be 12. Still, I think it is wrong because if we buy 5 tickets of the first type, he only has to pay 5 burles or the second way is to buy 2 tickets of the first type for the buses and the second type of ticket for the trolley, as they have the same number so they will be considered as 1. Therefore, we get 1*3 + 2*1 = 5. Can someone please tell me if am I right or I am missing something or the example is wrong?








So you think the example has been wrong for 11 years and nobody fixed it?
the first type of ticket only allows for 1 ride on 1 transport. So you need 19 tickets of first type and not 5 as you said.
You have to spend 2 burles for the first bus ($$$C_1 * 2$$$)
Take the unlimited number of rides for the second bus ($$$C_2 * 1$$$)
Take the unlimited number of rides for all the trolleys ($$$C_3 * 1$$$)
The result will be 12, you can see that this is the minimum possible cost
Bro I agree with this but the question mentions that the output should be the minimum number of burles.
I think you misunderstood the problem
The numbers
2 5and3 3 3are not the number of the bus or the trolleyIt is the number of how many times Vasya will take the $$$i_{th}$$$ bus or trolley
Bro then what is 2 3 In the second line
This is the number of buses and trolleys respectively
There are 2 buses and 3 trolleys
Vasya will take the first bus 2 times and the second bus 5 times
Vasya will take the first trolley 4 times, the second trolley 4 times and the third trolley 4 times
I hope you got it now ^_^
You are right, but you typed 3 instead of 4.
My bad, I edited the comment, thank you ^_^
Thanks bro. And one more thing you can reply any moment but when I want to reply it says that "You can write no more than 1 comments in 10 minutes. Why?
You're welcome
I really don't know why is that happening, but I think it is a rating-related anti-spam technique