(defvar *input* (make-list 1000))

(read-sequence *input* *standard-input*)

(setf *input* (mapcar
		#'(lambda (c)
		    (ecase c
		      (#\1 1) (#\2 2) (#\3 3) (#\4 4) (#\5 5) (#\6 6) (#\7 7)
		      (#\8 8) (#\9 9) (#\0 0))) *input*))
		      
(let* ((a (pop *input*)) (b (pop *input*)) (c (pop *input*)) (d (pop *input*)) (e (pop *input*))
       acc (max (* a b c d e)))
   (loop
     (setf acc (pop *input*))
     (when (not acc) (return))
     (rotatef a b c d e acc)
     (setf max (max max (* a b c d e))))
   (print max))
     