Because it is cheaper to buy the packs of 5, the teacher should satisfy the 11 students who want the vampire theme with 2 packs of 5 and 1 individual bag. This will cost the teacher 2*3 + 1*1 = $<<2*3+1*1=7>>7.
Similarly, the 14 students who want a pumpkin-themed bag can be satisfied by 2 packs of 5 and 4 individual bags at a cost of 2*3 + 4*1 = $<<2*3+4*1=10>>10.
Therefore, the teacher must spend 7 + 10 = $<<7+10=17>>17.
#### 17