He bought 12-3-2=<<12-3-2=7>>7 blue notebooks.
He paid 3*$4=$<<3*4=12>>12 for red notebooks
He paid 2*$2=$<<2*2=4>>4 for green notebooks
He spent $37-$12-$4=$<<37-12-4=21>>21 on blue notebooks.
Each blue notebook costs $21/7=$<<21/7=3>>3.
#### 3