cost calculation