Finding the values of a and b