math, brute force, two variable and one constraint