($x,$y)=<>=~/\S+/g;
($a,$b)=<>=~/\S+/g;
$x=-$x,$a=-$a if $x<0;
$y=-$y,$b=-$b if $b<0;
$d=$x>$y?$x:$y;
$d++ if $x==$y && $a==$b && $x>$a;
print $d;