s=$3+$2{for(y=$1;(y=x*($2-$3)-2)%s;x--);print x,y/s}
5 5 2 5 5 3 2 4 0 1 50 48 49
-3 1 -3 -1 -3 1 -99 1
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!