eval"N,*D,X,Y="+`dd`.split*?, p D.index(q=X.abs+Y.abs)?1:q<1?0:[D.max*2<-o=e=-q,D.sort.all?{|d|[e,o][d%2]=d;(o-e).abs>q||q>o+e}][q%2]?-1:2