Total number of boxes bought = 10
Total number of pencils in 7 boxes = 9 + 9 + 9 + 9...(7 times)
= 7 times 9 = 7 × 9 = 63
Remaining boxes = 3
No.of pencils in 3 boxes = 8 + 8 + 8 = 3 times 8 = 3 × 8 = 24
Total number of pencils = 63 + 24 = 87 pencils