After defeating all the PokeMasters, you feel hungry... for Toblerone bars! You pass by a PokeMart on the way to Cerulean City to see the beautiful Misty and you see many different Toblerone bars of different flavours that you want to buy. You decide that you should give yourself a treat and buy all the Toblerones that are sold in the shop. But now that there's a Great PokeMart Sale, the candy shop is offering a discount: Buy 4 Toblerone bars and get the one with the least cost of the 4 free.
Using this information, you want to find out what is the minimum cost you have to pay to buy all the Toblerones in the shop.
The first line gives the number of Toblerone bars in the shop, n where 1 ≤ n ≤ 100.
The next line contains n integers representing the price of each Toblerone.
Output the minimum total price by selectively choosing which items to bring to the counter at the same time.
300 200 100 400