How Much Should I Spend on Spray Foam Insulation?

What’s the average cost for having spray foam insulation used in my home? It needs to be sprayed under the entire roof of my Cape Cod, in the upstairs walls, and in about half of the first floor walls. 

[mai_avatar size="40" margin_right="-4px"][post_author_posts_link before=" by "][post_date before=" — "][mai_icon icon="comment-alt-lines" style="light" display="inline-block" size="1em" margin_left="12px" margin_right="-8px" margin_bottom="-4px"][post_comments][post_sponsor][shared_counts]
Technician applying spray foam insulation