<>;$_=<>; $x=y/357//d; $x+=$%while$%=s/19//g; $a=y/9//>>1; $b=y/1//; if($a<$b){ $x+=$a; $x+=$b-$a>>1 }else{ $x+=$b } print$x