10 students averaged 80, so the sum of their scores was (10 x 80) = 800
20 students averaged 89, so the sum of their scores was (20 x 89) = 1,780
All together, the sum of all 30 scores was (800 + 1,780) = 2,580
30 students totaled 2,580, so their average was (2,580 / 30) = 86 .