Total Cost Function Equation