Toukir is new in Dhaka and he just arrived today. He got a chance to study at Notre Dame College. After a full day bus journey and arranging his mess room, he now becomes thirsty. You know that, there is a lack of drinking water in Dhaka and his mess water tank is also empty. So he will go to the market to buy **N** liter bottled water. Before going to the market, he wants to calculate how much money he needs. Because if all the money is spent, who will give him money! Note that, there is only 1 liter and 2 liter water bottles are available to buy in the market. `He will either buy all 1 liter bottles`

`or buy all 2 liter bottles`

. But `if the number of bottles purchased is more than 5, then he will need a rickshaw`

to bring them. Now if the price of 1 liter water bottles is **A** Taka, the price of 2 liters water bottles is **B** Taka and the rickshaw fare from Toukir’s mess to the market is **P** Taka, can you tell the minimum amount of money Toukir needs to go with to the market?

This is a companion discussion topic for the original entry at https://toph.co/p/water-bottle-buying