(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (p (make-array n :element-type 'integer))) (dotimes (i n) (let* ((q (read))) (if (zerop q) (progn (format t "0~%") (return-from main 0)) (setf (aref p i) q)))) (when (= n 1) (let ((r (aref p 0))) (format t "~d~%" (if (zerop r) 0 (if (zerop (mod r 9)) 9 (mod r 9)))))) (let ((r (reduce #'(lambda (x acc) (mod (* x acc) 9)) p))) (format t "~d~%" (if (zerop r) 9 r))))) (main)