Question 80
At a competition, contestants fill every seat in a rectangular hall. The seats form rows and columns, with more than two rows and more than two seats in each row. At some point the contestants are instructed to shake hands only with their immediate neighbors: to the left, right, front, back, and diagonally.

There were 1020 handshakes. Let $n$ be the number of rows and $m$ the number of seats in each row.
a) What are the possible numbers of handshakes made by an individual contestant?
b) For each value $x$ from the preceding part, find how many contestants made $x$ handshakes.
c) Find the number of contestants in the hall.

There were 1020 handshakes. Let $n$ be the number of rows and $m$ the number of seats in each row.
a) What are the possible numbers of handshakes made by an individual contestant?
b) For each value $x$ from the preceding part, find how many contestants made $x$ handshakes.
c) Find the number of contestants in the hall.