(defvar N) (setq N (parse-integer (read-line))) (defvar X) (defvar Y) (defvar temp) (setq temp (read-line)) (setq temp (read-from-string (concatenate 'string "(" temp ")" ))) (setq X (nth 0 temp)) (setq Y (nth 1 temp)) ;(print X) ;(print Y) (defvar ans) (setq ans (- Y X)) (if (< ans 0) (progn (format t "-1~%") (quit))) (loop for i from 2 to N do (setq temp (read-line)) (setq temp (read-from-string (concatenate 'string "(" temp ")" ))) (setq X (nth 0 temp)) (setq Y (nth 1 temp)) (if (not (= (- Y X) ans)) (progn (format t "-1~%") (quit))) ) (format t "~d~%" ans)