The first students bought 2*2=<<2*2=4>>4 pencils
The next 6 students bought 6*3=<<6*3=18>>18 pencils
The last two students bought 1+1=<<1+1=2>>2 pencils
In total the store sold 4+18+2=<<4+18+2=24>>24 pencils
#### 24