The constraints of the second part of the problem are straightforward and the actual Pell equation that needs to be solved can easily be given. First, it asks that B+W should be a square, or using the values given above,