Summer trip
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
Due to the Summer Vacation, Mr. Heart decided to take a much-needed break from a stressful life, so he planned to travel at Cox's Bazar for a relaxing beach vacation with his friend. They booked a charming seaside hotel with a special pricing plan: the first D nights cost is A taka per night, while any additional nights were at a lower rate of B per night.
They spent their days soaking in the sun, enjoying the waves, and exploring the vibrant local markets. The mix of luxury and affordability made their trip both enjoyable and budget-friendly.
They spent N nights in this hotel, your task is to calculate the total accomodation fee which they spent on their trip.
Input
First Line T (1 ≤ T ≤ \(10^5\)), the number of test cases.
Second Line N and D(1 ≤ N , D ≤ \(10^5\))
Third line A , B (1 ≤ B < A ≤ \(10^6\))
Output
print the total accomodation fee of their trip
Sample
Input | Output |
---|---|
|
|
In the test case, First 3 nights cost will be (3 * 3000) = 9000 taka
rest of the 2 nights will be (2 * 2500) = 5000 taka
so the total spend of the trip will be 14000 taka
Information
- ID
- 1090
- Difficulty
- 4
- Category
- Beginners | Math Click to Show
- Tags
- # Submissions
- 217
- Accepted
- 90
- Accepted Ratio
- 41%
- Uploaded By