Addid manhattan distace calculation for the cost