(defun main (&rest argv) (declare (ignorable argv)) (let* ((g (read)) (c (read)) (p (read)) (s (read-line)) (gg (count #\G s)) (cc (count #\C s)) (pp (count #\P s)) (res 0)) (incf res (* 3 (+ (min g cc) (min c pp) (min p gg)))) (setf g (- g (min g cc)) cc (- cc (min g cc))) (setf c (- c (min c pp)) pp (- pp (min c pp))) (setf p (- p (min p gg)) gg (- gg (min p gg))) (incf res (+ (min g gg) (min c cc) (min p pp))) (format t "~d~%" res))) (main)