How to calculate the cost automatically based on a fix value?