Total Cost Function Example