(defun main (&rest argv) (declare (ignorable argv)) (let* ((a (make-array 1000005 :element-type 'integer)) (b (make-array 5 :element-type 'integer)) (q (read))) (dotimes (i 4) (setf (aref a i) (floor i 3) (aref b i) (floor i 3))) (loop for i from 4 to 1000000 do (setf (aref b 4) (mod (+ (aref b 0) (aref b 1) (aref b 2) (aref b 3)) 17)) (setf (aref a i) (aref b 4)) (dotimes (j 4) (setf (aref b j) (aref b (1+ j))))) (dotimes (_ q) (format t "~d~%" (aref a (1- (read))))))) (main)