$n=<>+1;map$s=($s+vec'bҌMZ',$_,8)*$n,0..6;print$s/630