$k=(glob<>)[$x=2];($y,$x)=$x,map$x|=0 x$_.$y,glob for<>;print$x=~/^.{0,$k}2/?$k+1-"@+":-1