3.1. The friends who came to visit Gavrila occupied all the three-legged stools and four-legged chairs in the room, but there was no place left for Gavrila himself. Gavrila counted that there were 45 legs in the room, including the "legs" of the stools and chairs, the legs of the visiting guests (two for each!), and Gavrila's own two legs. How many people were in the room?
Answer: 9. Solution. If there were $n$ stools and $m$ chairs, then the number of legs in the room is $3 n+4 m+2 \cdot(n+m)+2$, from which we get $5 n+6 m=43$. This equation in integers has the solution $n=5-6 p, m=3+5 p$. The values of $n$ and $m$ are positive only when $p=0$. Therefore, there were 5 stools and 3 chairs. Thus, the number of people in the room is: $5+3+$ Gavril.