(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (s (make-array n :element-type 'integer)) (m -9876543210) (res 0)) (dotimes (i n) (let* ((a (read)) (b (read)) (c (+ a (* b 4)))) (setf (aref s i) c m (max m c)))) (dotimes (i n) (when (/= (mod m 2) (mod (aref s i) 2)) (format t "-1~%") (return-from main)) (incf res (- m (aref s i)))) (format t "~d~%" (floor res 2)))) (main)