Total ages of four female teachers = 4 x 40 = 160
Total ages of eight male teachers = 8 x 25 = 200
Total ages of all the teachers in the school = 160 + 200 = 360
Average ages of all the teachers = total ages of all teacherstotal number of teachers
= 36012 = 30.