word problem piecewise function