<>;@d=sort{$a-$b}glob<>;map$z+=abs,glob<>;*a=$z&1?a:b;print$z?grep($z==$_,@d)?1:grep({$_&1?$b:$a=$_;$z>=abs$b-$a&$z<=$a+$b}@d)?2:-1:0