In get_rules/5: fix calculation of rule costs