How cost is calculated