#!perl -pa $_=<>;for$f(@F,@F){++$s,$f--while$f&&s/C//;++$i==3?$s*=3:y/GCP/PGC/}$_=$s