Math Olympiad | How to find a and b in this problem?