Update: OK, now I wrote the program, and in hindsight it was overkill. Just check the candidates for x+y starting from below, and the right solution appears pretty quickly (there are 24 candidates for x+y, but it is not necessary to check them all).