Average × count gives the total. Write every member in terms of one unknown using the gap, then solve from the total.
Adding the gap to the average (20 + 20 = 40), as if the average left the teacher out
Spread the gap over the whole group: the average rises by gap ÷ count above the students.