A pen in the shape of an isosceles right triangle with legs of length x ft and hypotenuse of length h ft is to be built. If fencing costs $ 2 divided by ft for the legs and $ 4 divided by ft for the hypotenuse, write the total cost C of construction as a function of h.