900=22 x 32 x 52900=22 x 32 x 52. There is only a limited number of options to build squares out of these factors. You can try them all, but in fact it is easy to see that the solution to your problem is p=22 x 32=36p=22 x 32=36 and Q=52=25Q=52=25. Their sum is 61.