# (Anti)Canonical divisor of a blow up

This question may be utterly trivial, or not, but as someone with hardly any knowledge of algebraic geometry I thought there could be a chance I get lucky.

Let X be a rational surface obtained by n blows up of $\mathbb{P}^1(\mathbb{C})\times\mathbb{P}^1(\mathbb{C})$. I write $H_x$ and $H_y$ for the lines x=constant and y=constant, and $E_i$ for the total transform of the point of the $i-th$ blow up. Is there some way to find what the canonical divisor on X is? Take for example the surface X blown up at the point $x=\infty$ , $y=\infty$, and then again on that divisor at some point.

(This example above occured when I cooked up an example to try and understand the resolution of singularities for the simple mapping x(n+2)+ax(n+1)+bx(n)=0).

I have seen for example, that the canonical divisor of $\mathbb{P}^2(\mathbb{C})$ blown up at 9 points is given by $K_X=-3H+E_1+E_2+...+E_9$. Is this true in general or only for a special class of surfaces?

-
If p:Y->X is the blowup of the surface X at a point x, and E is the exceptional divisor, then $K_Y=p^*K_X+E$. Hence the formula for the blowup of P^2 at 9 points. In the $P^1 \times P^1$ case, the canonical divisor is $-2(H_x+H_y)$, and you can compute the canonical divisor on the blowup easily. You can find all this in any book on algebraic surfaces, I bet.