The Cost of Stability and Its Application to Weighted Voting Games