The strategy is following
Smaller number subtract from the greater. Result is distance between two numbers
For example you have 3 and 8
8-3-5
5 is the distance between 3 and 8
It also works with the negative numbers, for example 3 and -5
3-(-5)=8
I don't understand your language and I don't know which language is this but I try to answer your question. 3-1000-3*100*4*1
3-1000-1200
3-2200
=-2197
+3 to both sides and you get s = -7
5x^2+3xy-25x-15y= 5x^2-25x+3xy-15y=
5x(x-5)+3y(x-5)=
= (x-5)(5x+3y)