I have a simple use case that requires a bit of recursive logic; and since I am new to this, would really appreciate some help. Here is the logic for the calculation

Policy Amount - Premium Amount

$0-$100 $50 (Fixed Rate)

$101-$200 $75 (Fixed Rate)

$201-$300 Rate per $20 (or fraction thereof) is $5

Over $300 Rate per $10 (or fraction thereof) is $3

As per the table, here are a few examples

If the Policy Amount is $70, Premium will be $50 (Rule #1)

If the Policy Amount is $175, Premium will be $175 (Rule #2)

if the Policy Amount is $220, Premium will be $75 (Rule #2)+ 5*(220-200)/20 (Rule #3)=$80

if the Policy Amount is 350, Premium will be $75 (Rule #2)+ 5*(300-200)/20 (Rule #3)+3*(350-300)/10=$75+$25+$15=$115