This question is about an exact sequence of four sheaves on a smooth projective surface $S$ over $k=\mathbb{C}$, to be found in Beauville: complex algebraic surfaces, theorem I.4, page 3 (second edition).
It comes down to this: Denote the exact sequence by $ 0 \rightarrow A \rightarrow B \rightarrow C \rightarrow D \rightarrow 0 $ then Beauville concludes $ \chi(A)-\chi(B)+\chi(C)-\chi(D) = 0 $ where $\chi(A) = \sum(-1)^{i}h^i(S,A)$ where $S$ is the surface.
How does he come to this conclusion? Of course an exact sequence of three sheaves yields a l.e.s. in cohomology, from which a similar result follows, but how to proceed with four sheaves as above? It might be easy, but i know just the basics of sheaf cohomology.
(Also see Exact sequence in Beauville's "Complex Algebraic Surfaces" for an earlier question about the same sequence)
If necessary i can provide the exact sheaves used in the sequence, but i hope that there's a general solution. Also i have an exam coming up, so prefer to save time (btw this is not homework). The sequence is also to be found in the link i provided.
Thanks in advance.