Alex has a list of items to purchase at a market. Theowner offers to discount each item after the firstone by the lowest marked price among the prioritems. No item's price can be discounted below o,and the list of items may not be reorderedCalculate the payable amountExampleAlex pays 2 for the first item since there are noprevious items to compare toThe second item costs 5.23The third item is free, marri min(25) 0) = max 1The fourth item costs 13The total cost to purchase all items is 2+ 3+0+38The first item is never discounted and theminimum cost of any item is aFunction DescriptionComplete the function calculateAmount in theeditor below. The function must return Alex's total cost to purchase all the items.​