  For any nonconstant f,g in C(x) such that the numerator H(x,y) of f(x)-g(y)
is irreducible, we compute the genus of the normalization of the curve
H(x,y)=0. We also prove an analogous formula in arbitrary characteristic when f
and g have no common wildly ramified branch points, and generalize to (possibly
reducible) fiber products of nonconstant morphisms of curves f:A-->D and
g:B-->D.
