whoops... so sorry about that... we need the ((11-r)*2500) to be this:
f(r=<9, ((11-r)*2500), 0
to make the formula be
100 + (if r<=9, ((11-r)*2500), 0) + (500*nh)
NOTE: The <= may need to be changed to =< to work properly... Again, I apologize for not being able to test this out fully for you.