First consider the unrestricted case. We have six people going into four rooms and each person has four choices which gives 4^{6}.
Now subtract the cases where the restriction of 4 people per room is broken.
Case 1 - We have 5 people + 1 person. If we fix 5 people to be in the first room, the 1 person can go into the three other rooms. Similarly, if we fix the 5 people across the other rooms etc leading to 4x3 possibilities. However there are six possible people who can be that 1 person so there are 6x4x3 possibilities altogether.
Case 2 - We have 6 people and there are four possibile rooms they can be in.
Altogether we get 4^{6} - 6x4x3 - 4 = 4020