luogu#P2134. 百日旅行
百日旅行
Background
What matters is not where to go, but being with you. — Xiaohong
For Xiaoming and Xiaohong, year month day is a beautiful day. This day is the -day anniversary of their acquaintance.
(Xiaoming: Xiaohong, thank you for your silent support during the major exams and your companionship over days and nights; thank you for lighting up my beautiful days and leaving me countless wonderful memories... On this beautiful day, I plan to take you on a trip.)
Problem Description
Xiaoming and Xiaohong have days of vacation left, and Xiaoming can plan the trip. If they travel for consecutive days, Xiaoming needs to spend yuan. If they do not travel for consecutive days, Xiaoming needs to treat Xiaohong to meals, costing yuan ( are constants given in the input).
Please help Xiaoming write a program to compute the minimum total amount he needs to spend during the vacation.
Input Format
The input contains a single line with three space-separated positive integers .
Output Format
Output one line with a single positive integer, representing the minimum amount of money Xiaoming needs to spend.
6 1 7
20
Hint
Constraints
- For of the testdata, .
- For of the testdata, , , .
- For of the testdata, , .
Translated by ChatGPT 5