Function for computing w-hardness.