  Partition functions for dimers on closed oriented surfaces are known to be
alternating sums of Pfaffians of Kasteleyn matrices. In this paper, we obtain
the formula for the coefficients in terms of discrete spin structures.
