print<>=~/ .* /<$'&($c=abs$`-$')>($d=abs$&-$')?$d+($`?$c-($-=$c-$'+1)+$`:$'+1):$c+$'