Calculate Cost From Margin