Updating the result cost