let () = let a, b = Scanf.scanf "%d %d " (fun a b -> a, b) in let c = if a < b then b - 2 else 2000000000 - b - 1 in Printf.printf "%d\n" c