Added constant function
corrected total cost