<>; @d=sort{$b-$a}glob<>; ($x,$y)=glob<>; if($x==0&&$y==0){ print 0; exit; } $z=abs($x)+abs($y); if(grep$z==$_,@d){ print 1; exit; } ($e[0])=grep{$_%2==0}@d; ($e[1])=grep{$_%2==1}@d; if(grep{$zd=abs($z-$_);$e[$zd&1]>=$zd}@d){ print 2; exit; } print -1;