Fixed greedy cost calculation