I believe this is the solution.

You have to the sum of all combinations (order doesn't matter) of the following combinations (excuse the redundancy).

A = 1 teacher & 6 students

B = 2 teachers & 5 students

C = 3 teachers & 4 students

The combination rule: (n!) ÷ [(n-k)!n!]. I am assuming further explanation regarding the factorial "!" is in your textbook.

Let C(A) represent the number of combinations of A, and so on.

C(A) = (7 choose 1) * (12 choose 6) = 7x924.

Do this for the remaining two possible general combinations, B and C. Then sum the total combinations to get 40425.

I hope this helps. Let me know if you have any questions.

Best of luck!