(defun check (x y M) (let* ((a (first M)) (b (second M)) (c (third M)) (d (fourth M))) (= (+ (* a x) (* b y)) (+ (* c x) (* d y))))) (defun main (&rest argv) (declare (ignorable argv)) (let* ((x (read)) (y (read)) (E '(1 0 0 1)) (A '(0 1 1 0)) (B '(1 1 1 -1)) (A*B '(1 -1 1 1)) (B*A '(1 1 -1 1)) (A*B*A '(-1 1 1 1)) (B*A*B '(2 0 0 -2)) (A*B*A*B '(0 -2 2 0))) (format t "~d~%" (cond ((check x y E) 0) ((or (check x y A) (check x y B)) 1) ((or (check x y A*B) (check x y B*A)) 2) ((or (check x y A*B*A) (check x y B*A*B)) 3) ((check x y A*B*A*B) 4) (t -1))))) (main)