Input combination and total cost calculation