#B3657. Minimum Cost for Park Tickets
Minimum Cost for Park Tickets
Minimum Cost for Park Tickets
Little A goes to the park with the family. The ticket price list is shown below:
There are x adults and y children in Little A's family. The park offers three types of tickets:
- Adult Ticket: \(25\) dollars per adult.
- Child Ticket: \(12\) dollars per child.
- Family Ticket: \(40\) dollars which covers 2 adults and 2 children.
You can purchase any combination of tickets. Note that if you buy a family ticket, it covers exactly 2 adults and 2 children. For any remaining people who cannot be grouped into a family ticket, you must buy individual tickets. Calculate the minimum total amount required to buy tickets for the whole family.
Note: You are allowed to purchase 0 or more family tickets. For each possible number \(k\) (where \(0 \le k \le \min(\lfloor x/2\rfloor, \lfloor y/2\rfloor)\)), the total cost is:
\[ \text{cost} = k\times40 + (x-2k)\times25 + (y-2k)\times12. \]Your task is to output the minimum cost possible.
inputFormat
The input consists of a single line containing two integers x and y (0 ≤ x, y ≤ 1000), representing the number of adults and children, respectively.
outputFormat
Output a single integer which is the minimum total cost for the family tickets.
sample
1 2
49